Repository navigation
Not planned
Not planned
Copy link
Description
Overview
In the outline viewer a node's data reaches its control as a copied object passed down through props, and an edit travels back up through three levels of dispatched events. ADR-049 decided that components read the store directly. Forms, tables, kanban and checkbox-node.svelte already do. The outline rows, the product's core surface, do not. This issue makes them.
Findings come from a code-reading review; line numbers must be re-checked.
Problem Statement
- Read path today:
visibleNodesFromStoresinbase-node-viewer.svelte(around lines 182-249) flattens the structure tree and the store into new{...node, depth, children}objects. Every keystroke rebuilds every row object. These go toNodeRowas props (node-row.svelte, around lines 103-110), then to the type wrapper, then toBaseNode. - Write path today: the textarea controller raises
contentChanged,BaseNodere-raises it throughcreateEventDispatcher(base-node.svelte, around line 566), the wrapper re-dispatches,NodeRowcalls back, andhandleContentChangedin the viewer (around line 933) callsnodeManager.updateNodeContent.createEventDispatcherappears about 30 times in non-test frontend code. - Depth is stored twice:
_uiState[id].depthinreactive-node-service.svelte.tsis maintained by hand through indent, outdent and rollback, although the viewer recomputes depth from the tree.
A row therefore depends on the whole flattened list instead of on its own node, and data the store owns exists in several derived copies between the store and the control.
Proposed Solution
- The viewer derives only
{id, depth}per visible row from the structure tree. NodeRowand the node components read$derived(sharedNodeStore.getNode(id)), ascheckbox-node.sveltedoes (around lines 39-44).- Replace
createEventDispatcheron the node path with callback props. - Derive depth from the tree and delete
_uiState.depthand its hand maintenance.
Documentation
- ADR-049 Decision items 2 and 5 - components read the store directly, and there is exactly one copy of a node's data.
- Frontend State & Persistence - layers:
ReactiveNodeService,SharedNodeStore,ReactiveStructureTree. - Component Architecture - the
BaseNode/ wrapper /BaseNodeViewerhierarchy and naming, which stays as it is. - Updates:
frontend-state-and-persistence.md(per-viewer UI state no longer holds depth; the read path) andcomponent-architecture.md(callback props replace dispatched events) in the same change.
Architecture Impact
Implements ADR-049 for the outline rows. No decision changes.
Acceptance Criteria
- The viewer's per-row derived value holds ids and depth only; no row object is a copy of node data
-
NodeRowand every node wrapper read their node fromsharedNodeStore.getNode(id) - A test shows that editing one node's content does not re-evaluate another row's derived node
- No
createEventDispatcherremains on the path fromBaseNodeto the viewer; callbacks are typed props -
_uiState.depthand every hand update of it are deleted; depth comes from the structure tree - The same node open in two panes shows the same content in both, and editing in one updates the other
-
bun run test:changedandbun run test:browserpass;bun 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/node-row.svelteandnode-row-types.tspackages/desktop-app/src/lib/design/components/base-node.svelteand the*-node.sveltewrapperspackages/desktop-app/src/lib/services/reactive-node-service.svelte.ts
Implementation Details
checkbox-node.svelteis the pattern to follow for reading by id.- Placeholder nodes exist in the viewer before the store has them; decide how a row for an unsaved placeholder reads its data (see "Placeholder Nodes" in
frontend-state-and-persistence.md) and keep that in one place. - Use
isAfrom the registry for any type test; no literalnodeTypecomparisons. - No
any, no lint suppression;createLogger, notconsole.*.
Dependencies
- Remove dead editor workarounds and state-writing effects that ADR-049 forbids #4378 (removes the wrapper-local content writes this builds on)
Non-Goals
- The edit session and caret handling.
- The store's internal structure.
Activity
malibio commentedon Nov 28, 2026
Moved to NodeSpace: the issue "Outline rows read their node from the store by id, with callback props instead of dispatched events" (
7ec78f96-1bb1-421a-b9bc-cbe0c486449f) in the NodeSpace workspace. The team's work is tracked there, so this GitHub copy is closed to keep its status in one place.