@@ -148,11 +148,11 @@ const NodeConfig = ({
148148 const shortcutUid = getUid ( "Shortcut" ) ;
149149 const tagUid = getUid ( "Tag" ) ;
150150 const templateUid = getUid ( "Template" ) ;
151- const specificationUid = getUid ( "Specification" ) ;
152- const indexUid = getUid ( "Index" ) ;
153151 const overlayUid = getUid ( "Overlay" ) ;
154- const graphOverviewUid = getUid ( "Graph Overview" ) ;
155152 const canvasUid = getUid ( "Canvas" ) ;
153+ const graphOverviewUid = getUid ( "Graph Overview" ) ;
154+ const specificationUid = getUid ( "Specification" ) ;
155+ const indexUid = getUid ( "Index" ) ;
156156 const suggestiveRulesUid = getUid ( "Suggestive Rules" ) ;
157157 const attributeNode = getSubTree ( {
158158 parentUid : node . type ,
@@ -167,11 +167,7 @@ const NodeConfig = ({
167167 value : formatValue ,
168168 handleChange : handleFormatChange ,
169169 handleBlur : handleFormatBlurFromHook ,
170- } = useDebouncedRoamUpdater (
171- formatUid ,
172- node . format ,
173- ! formatError ,
174- ) ;
170+ } = useDebouncedRoamUpdater ( formatUid , node . format , ! formatError ) ;
175171
176172 const validateTag = useCallback (
177173 ( tag : string ) : string | undefined => {
@@ -193,9 +189,11 @@ const NodeConfig = ({
193189
194190 const validateFormat = useCallback (
195191 ( {
192+ tag,
196193 format,
197194 isSpecificationEnabled,
198195 } : {
196+ tag : string ;
199197 format : string ;
200198 isSpecificationEnabled ?: boolean ;
201199 } ) => {
@@ -208,7 +206,7 @@ const NodeConfig = ({
208206 setFormatError ( "Error: you must set either a format or specification" ) ;
209207 return ;
210208 }
211- const cleanTag = getCleanTagText ( tagValue ) ;
209+ const cleanTag = getCleanTagText ( tag ) ;
212210
213211 if ( ! cleanTag ) {
214212 setFormatError ( "" ) ;
@@ -229,23 +227,23 @@ const NodeConfig = ({
229227
230228 if ( hasConflict ) {
231229 setFormatError (
232- `The format references the node's tag "${ tagValue } ". Please use a different format or tag.` ,
230+ `The format references the node's tag "${ tag } ". Please use a different format or tag.` ,
233231 ) ;
234232 } else {
235233 setFormatError ( "" ) ;
236234 }
237235 } ,
238- [ specificationUid , tagValue ] ,
236+ [ specificationUid ] ,
239237 ) ;
240238
241239 useEffect ( ( ) => {
242- validateFormat ( { format : formatValue } ) ;
240+ validateFormat ( { tag : tagValue , format : formatValue } ) ;
243241 } , [ tagValue , formatValue , validateFormat ] ) ;
244242
245243 const handleFormatBlur = useCallback ( ( ) => {
246244 handleFormatBlurFromHook ( ) ;
247- validateFormat ( { format : formatValue } ) ;
248- } , [ handleFormatBlurFromHook , formatValue , validateFormat ] ) ;
245+ validateFormat ( { tag : tagValue , format : formatValue } ) ;
246+ } , [ handleFormatBlurFromHook , tagValue , formatValue , validateFormat ] ) ;
249247
250248 return (
251249 < >
@@ -286,7 +284,7 @@ const NodeConfig = ({
286284 settingKeys = { [ "tag" ] }
287285 defaultValue = { node . tag }
288286 placeholder = { generateTagPlaceholder ( node ) }
289- validate = { validateTag }
287+ getValidationError = { validateTag }
290288 onChange = { setTagValue }
291289 order = { 2 }
292290 parentUid = { node . type }
@@ -333,6 +331,7 @@ const NodeConfig = ({
333331 parentUid = { specificationUid }
334332 parentSetEnabled = { ( isSpecificationEnabled ) => {
335333 validateFormat ( {
334+ tag : tagValue ,
336335 format : formatValue ,
337336 isSpecificationEnabled,
338337 } ) ;
@@ -382,7 +381,10 @@ const NodeConfig = ({
382381 title = "Canvas"
383382 panel = {
384383 < div className = "flex flex-col gap-4 p-1" >
385- < DiscourseNodeCanvasSettings nodeType = { node . type } uid = { canvasUid } />
384+ < DiscourseNodeCanvasSettings
385+ nodeType = { node . type }
386+ uid = { canvasUid }
387+ />
386388 < DiscourseNodeFlagPanel
387389 nodeType = { node . type }
388390 title = "Graph Overview"
@@ -402,7 +404,10 @@ const NodeConfig = ({
402404 title = "Suggestive mode"
403405 panel = {
404406 < div className = "flex flex-col gap-4 p-1" >
405- < DiscourseNodeSuggestiveRules node = { node } parentUid = { suggestiveRulesUid } />
407+ < DiscourseNodeSuggestiveRules
408+ node = { node }
409+ parentUid = { suggestiveRulesUid }
410+ />
406411 </ div >
407412 }
408413 />
0 commit comments