ENG-1225: Discourse node migration simple settings#696
ENG-1225: Discourse node migration simple settings#696sid597 wants to merge 8 commits intographite-base/696from
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3ac2996 to
d549f8d
Compare
a82cfaf to
bc0de10
Compare
d549f8d to
78b7dbb
Compare
bc0de10 to
57abc42
Compare
78b7dbb to
d66fa03
Compare
57abc42 to
7ead54e
Compare
d66fa03 to
cb22590
Compare
490810f to
8dc5276
Compare
cb22590 to
78abef0
Compare
8dc5276 to
8286d6b
Compare
78abef0 to
3966245
Compare
8286d6b to
78e8311
Compare
3966245 to
7015148
Compare
7015148 to
ecdee21
Compare
78e8311 to
938f6aa
Compare
ecdee21 to
96f4575
Compare
ee13988 to
3b51bcc
Compare
2b100df to
9958371
Compare
9958371 to
c7a0860
Compare
3b51bcc to
23e6249
Compare
c7a0860 to
989b9b4
Compare
23e6249 to
2700c52
Compare
2700c52 to
7cd4348
Compare
989b9b4 to
4ed3358
Compare
7cd4348 to
70a27fd
Compare
4ed3358 to
2bf5564
Compare
| title="First Child" | ||
| description="If the block is the first child of the embedding block ref, it will be embedded and ranked." | ||
| settingKeys={["suggestiveRules", "isFirstChild"]} | ||
| initialValue={node.isFirstChild?.value || false} |
There was a problem hiding this comment.
Schema mismatch: accessing .value on a boolean. The schema was changed so isFirstChild is now a boolean (line 80 in zodSchema.ts), not an object with {uid, value}. This will always evaluate to false since undefined?.value is undefined.
// Fix:
initialValue={node.isFirstChild || false}| initialValue={node.isFirstChild?.value || false} | |
| initialValue={node.isFirstChild || false} |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| @@ -64,14 +55,6 @@ const DiscourseNodeSuggestiveRules = ({ | |||
| [nodeUid], | |||
There was a problem hiding this comment.
Missing reactive update: removed useEffect that updated embeddingRef when node.embeddingRef changed. The DiscourseNodeTextPanel uses initialValue which only sets state on mount. If the parent component renders with a different node prop, the embedding ref input will show stale data.
// Add back:
useEffect(() => {
setEmbeddingRef(node.embeddingRef || "");
}, [node.embeddingRef]);| const [embeddingRef, setEmbeddingRef] = useState(node.embeddingRef || ""); | |
| useEffect(() => { | |
| setEmbeddingRef(node.embeddingRef || ""); | |
| }, [node.embeddingRef]); | |
| const blockUidToRender = useMemo( | |
| () => extractRef(embeddingRef), | |
| [embeddingRef, nodeUid] |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| syncToBlock?.(newValue); | ||
| onChange?.(newValue); | ||
|
|
||
| if (getValidationError?.(newValue)) return; |
There was a problem hiding this comment.
🟡 Pending debounce not cleared on validation failure causes stale value to be persisted
When a user types a value that fails validation in BaseTextPanel, the function returns early without clearing the previously scheduled debounce timeout. This causes the prior (now-stale) valid value to be persisted to both block props and the Roam block tree.
Detailed scenario and root cause
Consider the "Tag" field in NodeConfig.tsx with format [[CLM]] - {content}:
- User types
"C"→ valid → debounce scheduled to save"C"after 250ms (timeout A) - At t=100ms user types
"CL"→ valid → timeout A cleared, new debounce for"CL"(timeout B, fires at t=350ms) - At t=200ms user types
"CLM"→ invalid (conflicts with format) →getValidationErrorreturns error → early return atBlockPropSettingPanels.tsx:136, timeout B is NOT cleared - At t=350ms, timeout B fires → saves
"CL"viasetter(settingKeys, "CL")andsyncToBlock?.("CL")
The UI shows "CLM" with a red error message, but the partial value "CL" was silently persisted. The user never intended to save "CL" — they were still typing and got an error. This unintended intermediate save can also trigger downstream side effects.
Impact: Any DiscourseNodeTextPanel with a getValidationError prop (currently the Tag field) may persist unintended partial values.
| if (getValidationError?.(newValue)) return; | |
| window.clearTimeout(debounceRef.current); | |
| if (getValidationError?.(newValue)) return; | |
Was this helpful? React with 👍 or 👎 to provide feedback.

https://www.loom.com/share/9aa6f5f8815e41de92f21e14f7f5f855
demo video
changes done to following settings
"Key Image" — DiscourseNodeCanvasSettings.tsx
"Embedding Block Ref" — DiscourseNodeSuggestiveRules.tsx
"First Child" — DiscourseNodeSuggestiveRules.tsx
"Description" — NodeConfig.tsx
"Shortcut" — NodeConfig.tsx
"Tag" — NodeConfig.tsx
"Graph Overview" — NodeConfig.tsx
ENG-1225: Discourse node migration
Migrate personal settings text inputs
remove unnecessary checks zod takes care
migrate attributes overlay and suggestive rules
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.