Repository navigation
Description
Overview
A code-reading review of the frontend's reactivity found a set of small, independent violations of the canonical store pattern: dead workarounds in the outline viewer, node wrappers that keep a local override of a node's content, two effects that should be derived values, and a stale-result guard that compares too little. None needs a design decision. This issue removes them in place.
Findings come from reading code, not from running it. Line numbers are as of the review and must be re-checked; the three items marked inferred have not been reproduced.
Problem Statement
base-node-viewer.svelteholds workarounds that do nothing or that the project rules forbid:requestNodeFocuspatchestextarea[id="textarea-${nodeId}"](around lines 519-531), but the textarea's real id istextarea__{paneId}__{nodeId}(base-node.svelte:837), so the selector never matches.- "Update the original node's content to itself, which should trigger focus" (around lines 634-642).
- Two "TRANSITION PERIOD" fallbacks from the structure tree to the store (around lines 195-221). AGENTS.md forbids transition-period code.
textarea-controller.svelte.tshas a cleanup-only$effect.pre(around line 1302) that duplicates theonDestroyinbase-node.svelte(around line 729).- Eight node wrappers assign to their
$bindablecontentprop (header-node.svelte:109,task-node.svelte:98,quote-block-node.svelte:93,ordered-list-node.svelte:122,code-block-node.svelte:235,252,table-node.svelte:73,horizontal-line-node.svelte:48).NodeRowdoes not bind that prop, so the assignment is a wrapper-local override of data the store owns. Inferred: if the store rejects or alters the write, the wrapper keeps showing its override. - Two effects write reactive state that is a pure function of other state:
components/settings/settings-pane.svelte:30correctsactiveCategorywhen it is not visible.components/relationships/relationship-viewer-modal.svelte:216fallsselectedKeyback to the first populated group.
components/chat/remote-tool-confirmation-card.svelte:credentialsismessage.confirmationCredentials ?? [](line 57), a new array on every message update, and the stale guard in the effect at line 71 compares summary and arguments only. Inferred: a message update can reset the check, the arming delay and the buttons.components/layout/database-name-dialog.svelte:33seedsnameon open but also tracksinitialValue, so a prop change while the dialog is open overwrites what the user typed.
Proposed Solution
Delete the dead code, make the wrappers read content from their props only (the write already goes to the store through the content-changed event), replace the two corrective effects with a $derived effective value, give the confirmation card a stable empty array and a guard that covers every field the check depends on, and seed the dialog's name in its open handler.
Documentation
- ADR-049 Decision items 4 and 5 - an effect never writes reactive state, and a component keeps no local copy of node data. Every change here applies those two items.
- Frontend State & Persistence - the store and structure tree the fallbacks read from.
- Updates: the review reported these doc statements as not matching the code. Check each and correct the doc (nodespace-docs, direct to main):
frontend-state-and-persistence.mdsaysperson-schema-formcallsbackendAdapter.updateNodedirectly; the code callssharedNodeStore.updatePersonNode. The same paragraph cites an issue number, which docs must not do.- Same doc, "Domain event echo": says an incoming event with an equal or older version is ignored;
remote-update-policy.tsapplies any database update to a node that is not being edited. - Same doc lists the structure tree under
services/; it isstores/reactive-structure-tree.svelte.ts. frontend-architecture.mdsays a viewerless type's fallback viewer is always cached;pane-content.sveltecaches nothing in that case.- ADR-049 states effects never write reactive state; record the remaining sites or remove them.
Architecture Impact
Implements ADR-049 as written. No decision changes.
Acceptance Criteria
- The three dead workarounds and both "TRANSITION PERIOD" fallbacks are gone from
base-node-viewer.svelte, and merge, split and focus-after-create still work - The duplicate cleanup effect in
textarea-controller.svelte.tsis gone and the controller is destroyed exactly once - No node wrapper assigns to its
contentprop;contentis not$bindablewhere nothing binds it -
settings-pane.svelteandrelationship-viewer-modal.sveltecompute the effective category and selection with$derived, with no corrective effect - The confirmation card does not reset its check, arming delay or buttons when the message updates without its confirmation fields changing; a test covers it
-
database-name-dialog.sveltekeeps typed text wheninitialValuechanges while open - The doc statements listed under Documentation are checked and corrected where wrong
-
bun run test:changedpasses andbun run quality:fixis clean
Technical Specifications
Files to Modify
packages/desktop-app/src/lib/design/components/base-node-viewer.sveltepackages/desktop-app/src/lib/design/components/textarea-controller.svelte.tspackages/desktop-app/src/lib/design/components/{header,task,quote-block,ordered-list,code-block,table,horizontal-line}-node.sveltepackages/desktop-app/src/lib/components/settings/settings-pane.sveltepackages/desktop-app/src/lib/components/relationships/relationship-viewer-modal.sveltepackages/desktop-app/src/lib/components/chat/remote-tool-confirmation-card.sveltepackages/desktop-app/src/lib/components/layout/database-name-dialog.svelte
Implementation Details
- Before deleting each workaround, confirm it is dead: the selector mismatch is verified; for the self-assignment and the fallbacks, check that the behaviour they claim to protect still holds without them.
- Some wrappers pass
bind:contentdown toBaseNode. Removing the wrapper's own assignment must not break that path; ifBaseNodenever writes the prop either, drop the binding too. - The other state-writing effects the review listed (person-form draft mirrors, dialog reset-on-open, kanban reveal reseed, relationship modal pruning) write component-local UI state and are not race sources; leave them unless they fall out naturally.
Non-Goals
- Changing how rows receive node data, the edit session, or the store's structure. Those are separate issues.
Activity
malibio commentedon Nov 28, 2026
Moved to NodeSpace: the issue "Remove dead editor workarounds and state-writing effects the reactivity rule forbids" (
c6cb44c4-5625-4450-af5e-c84201cfad91) in the NodeSpace workspace. The team's work is tracked there, so this GitHub copy is closed to keep its status in one place.