Repository navigation
Description
Bug Description
Commit 0ed40002 ("Smart navigation for non-root node links with scroll-to-target", #910) introduced a regression where opening a task node in a new tab no longer opens the TaskNodeViewer — it opens the parent node's viewer instead (typically BaseNodeViewer for a text/date node).
Root Cause
resolveWithRootAncestor() in navigation-service.ts unconditionally walks up the structure tree to find the root ancestor and uses that node's nodeType for the tab. This is correct for primitive child nodes (text blocks, headers, code blocks) that belong to their parent's viewer, but incorrect for entity nodes like tasks that have their own dedicated viewer.
Task nodes can have a parent in the tree (e.g., under a date node), but they are not "primitive" content — they have a title field and a dedicated TaskNodeViewer. The root-ancestor resolution should stop at entity node boundaries, not walk all the way to the tree root.
Reproduction
- Open NodeSpace with task nodes nested under a date or text node
- Click the open button on a task node
- Expected: Task opens in TaskNodeViewer in the other pane
- Actual: The parent (date/text) node opens in BaseNodeViewer
Affected Code
packages/desktop-app/src/lib/services/navigation-service.tsfindRootAncestor()(line ~132) — walks up unconditionallyresolveWithRootAncestor()(line ~185) — uses root's nodeType- Called by both
navigateToNode()andnavigateToNodeInOtherPane()
Proposed Fix
Make findRootAncestor() aware of node types that have their own viewer. Stop walking up when the current node is an "entity" type (task, date, query, etc.) rather than a "primitive" type (text, header, code-block). This can be done by:
- Checking the node's type during the ancestor walk
- Stopping at nodes registered with a viewer in the plugin registry
- Or adding a concept of "viewer-owning" node types that act as navigation boundaries
Acceptance Criteria
- Clicking the open button on a task node opens TaskNodeViewer (not the parent's viewer)
- Clicking a wikilink to a primitive child node still resolves to the root ancestor and scrolls to it (existing Smart navigation for non-root node links with scroll-to-target #910 behavior preserved)
- Other entity node types with dedicated viewers (date, query) also open correctly
- Existing navigation tests pass
- New test coverage for entity-node-within-parent navigation scenario
Activity
Fix entity node navigation resolving to parent viewer instead of own …
Fix: Smart navigation resolveWithRootAncestor breaks task node viewer…
Fix: Smart navigation resolveWithRootAncestor breaks task node viewer…