Repository navigation
Description
Overview
QueryNodeViewer (the schema-type list/table/kanban view opened from the sidebar, e.g. clicking "Project" or "Skill") loads its results once via a one-shot query and never listens for node:created events. A node created through any path other than that viewer's own "+New" button — the CLI, an agent tool call, another tab, another window — does not appear in an already-open matching query view until the view is fully remounted (e.g. switching to another tab and back).
Problem Statement
Reproduction:
- Open the
project(orskill) query view from the sidebar, leave it open - Create a new
projectnode via another path — reproduced vianodespace node create --type project --content "Sample Project"(the CLI, bypassing the UI entirely) - The already-open query view does not show the new node
- Switch to a different tab, then switch back to the query view — the new node now appears
Root cause:
loadedNodeIds (packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte:86) is populated by loadAndQuery() (line 175), which runs a single backendAdapter.queryNodes({ nodeType, limit: FETCH_LIMIT }) call. It is invoked from:
onMount(line 162)- An
$effectreacting tonodeIdchanges (line 393, insideuntrack(() => loadAndQuery(nodeId)), itself only reachable via the query-save path) - The viewer's own "+New" handler, which appends directly to
loadedNodeIdsfor the node it just created (line 535)
There is no subscription to node:created (or any other signal) that would append an externally-created node matching the viewer's targetType/nodeType into loadedNodeIds while the view is already mounted and open. The daemon does emit the event correctly — packages/desktop-app/src-tauri/src/watcher.rs:186-195 forwards NodeEventKind::Created as node:created with node_type included, and packages/desktop-app/src/lib/services/tauri-sync-listener.ts:365 does listen for it and hydrates the node into sharedNodeStore (queueOrFetchNode, line 387) — but nothing downstream tells QueryNodeViewer to add that id to its own result list. The "reappears on tab switch" behavior is consistent with Svelte remounting the component (re-running onMount → loadAndQuery) when navigating back to the tab, not any reactive update.
Proposed Solution
Add a listener/subscription in QueryNodeViewer for newly-created nodes matching its current query's type, and append matching ids to loadedNodeIds when the view is mounted and the created node's type matches schemaNode.id (default type view) or definition.targetType (saved query mode) — mirroring the same epoch/load-id staleness discipline already used elsewhere in this file (currentLoadId, sharedNodeStore.currentEpoch()) so a node created during a mid-flight query switch isn't injected into a now-stale view.
Given tauri-sync-listener.ts already receives and forwards node:created, the most direct fix is likely a Svelte $effect (or a sharedNodeStore-level subscription, if one exists for this purpose) that watches for newly-hydrated nodes of the matching type and appends them — reusing the existing shouldIntegrateInstance() guard (packages/desktop-app/src/lib/services/schema-authoring.ts:52-57) if it fits, rather than writing a parallel staleness check.
Acceptance Criteria
- A node created via a path other than the open viewer's own "+New" button (CLI, agent tool call, another tab/window) appears in an already-open matching
QueryNodeViewerwithout requiring a tab switch or remount - Update is scoped to the currently-open view's type/query — a
projectcreated while askillview is open must not appear there - Respects the existing epoch/load-id staleness discipline — a node created during a mid-flight query reload or database switch is not injected into a stale view
- Works for all three view modes (List, Table, Kanban) since all three render from the same
loadedNodeIds - No new test failures (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte—loadedNodeIdsstate (line 86),loadAndQuery()(line 175),handleCreateInstance()'s existing append pattern (line 535) as a model for how to splice a new id in safelypackages/desktop-app/src/lib/services/tauri-sync-listener.ts(lines 364-387) — existingnode:createdlistener; confirms the event reaches the frontend and is already hydrated intosharedNodeStoreviaqueueOrFetchNodepackages/desktop-app/src-tauri/src/watcher.rs(lines 186-195) — confirms the daemon-side event forwarding includesnode_type, so a type-match filter is possible without an extra fetchpackages/desktop-app/src/lib/services/schema-authoring.ts(lines 52-57) —shouldIntegrateInstance(), the existing epoch/load-id staleness guard used by the "+New" path; reuse rather than duplicate if the shape fits
Non-Goals
- Does not address
node:updated/node:deletedreactivity for already-loaded rows inQueryNodeViewer— only presumed already working viasharedNodeStorerow-level reactivity (each row callssharedNodeStore.getNode(id)per the comment at line 83); confirm during implementation and file separately if that turns out to be broken too. - Does not change the "+New" button's own append logic (line 535), which already works correctly for self-created nodes.
Related Issues
- Default new node content to "Untitled {Type}" for name-as-content core types (project, skill) #1995 (surfaced this bug while manually verifying the fix scope for
project/skillnode creation)
Activity
Reactively add externally-created nodes to an open QueryNodeViewer (#…
mstomar125 commentedon Aug 10, 2026
Resolved by PR #2019 (merged, main
e42a5273). QueryNodeViewer now subscribes tosharedNodeStoreon mount and folds in externally-created nodes (CLI, agent tool call, another tab/window) that belong to the current view — via a pureshouldShowCreatedNodegate (settled view + type/'*' match + client-side filters + dedup), unsubscribing on teardown. Works across List/Table/Kanban; the load-time self-append and staleness are guarded viaqueryState, and the +New path is deduped so it never double-appends. Independent review (2 rounds) APPROVE.