Skip to content

Tab title and query views show stale cached title instead of current content #2012

Closed

Description

@malibio

Overview

Follow-up to #2005 / #2011. That PR fixed the stale cached title in BaseNodeViewer's header, but deliberately scoped itself there per the issue's Non-Goals. The same root cause is still live on several other surfaces, so the user-visible bug is only partially resolved: for the node that reproduced #2005, the viewer header is now correct while the tab title still shows /.

Root cause (unchanged from #2005)

sharedNodeStore's cached title is only refreshed by a backend round-trip, while optimistic content updates patch content and spread title forward untouched. Any surface preferring title || content therefore surfaces a title computed for an earlier, possibly differently-typed state — e.g. strip_markdown("/") captured while a node was still text, before conversion to task.

#2011 fixed this for the viewer header by preferring .title only for genuinely titleTemplate-driven schemas, where title is property-computed and legitimately distinct from content.

Affected call sites

  • packages/desktop-app/src/lib/plugins/plugin-registry.ts:469 — getNodeTitle() returns node.title || node.content. This is the highest-impact one: it backs computeTabTitle (utils/tab-title.ts:33), so tab titles show the stale value.
  • packages/desktop-app/src/lib/components/query/list-view.svelte:35
  • packages/desktop-app/src/lib/components/query/kanban-view.svelte:90
  • packages/desktop-app/src/lib/components/query/table-row.svelte:91
  • packages/desktop-app/src/lib/stores/collections.svelte.ts:445

Each should be reviewed individually — some may legitimately want the computed title.

Suggested approach

computeHeaderDisplayValue (design/components/node-type-predicates.ts) already encodes the correct rule: prefer title only when the type is genuinely template-driven, otherwise content is the source of truth. The main design question is how these call sites determine "is this type template-driven", since they lack the viewer's SchemaFormLoader. pluginRegistry.findSlashCommand(nodeType)?.hasTitleTemplate — already used by node-row.svelte:129 for exactly this — looks like the natural handle.

Worth considering whether the shared rule belongs in one helper all these surfaces call, rather than being re-derived per site.

Related

Note that hasTitleTemplate on the frontend is custom-schema-scoped, while the backend's compute_title() applies a title_template to any schema carrying one, core or not. These agree only because no core type ships a template today (documented at schema-form-loader.svelte.ts's hasTitleTemplate getter in #2011). Any fix here should keep that assumption in one place rather than spreading it further.

Acceptance Criteria

  • Tab title for a node whose title went stale shows current content, not the stale cached value
  • Query list/kanban/table views show current content for non-template types
  • No regression for titleTemplate-driven types on any of these surfaces — computed title still displays
  • The title-vs-content rule is not duplicated per call site
  • No new test failures (bun run test:all)

Activity

  1. added
    bug
    on Aug 7, 2026
  2. malibio commented on Aug 7, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-2012-title-vs-content): Frontend: 191 test files passed, 4447 tests passed.

  3. self-assigned this
    on Aug 7, 2026
  4. mstomar125 commented on Aug 20, 2026

    @mstomar125
    Contributor

    Fixed in #2179 (merged cd08ec7).

    Extended #2011's title-vs-content rule to the five other call sites named here:

    • plugin-registry.ts's getNodeTitle (backs tab titles via computeTabTitle) — the highest-impact one, since tab titles were showing the stale value
    • list-view.svelte, kanban-view.svelte, table-row.svelte (both the content column and the row tooltip)
    • collections.svelte.ts's selectedCollectionMembers

    Consolidated the rule into one shared helper, resolveTitleOrContent (lib/utils/node-display-title.ts), rather than re-deriving it per site: prefer title only when the schema is genuinely title_template-driven, content otherwise. computeHeaderDisplayValue (the #2011 header fix) now delegates to it too instead of duplicating the logic.

    PluginRegistry gained resolveDisplayTitle(node), which applies that rule using findSlashCommand(nodeType)?.hasTitleTemplate as the template signal (the same flag node-row.svelte already used for this). The four row-based surfaces (list/kanban/table/collections) call resolveDisplayTitle rather than getNodeTitle, deliberately skipping a plugin's getTitle override (e.g. date's "Today"/"Tomorrow" formatting) — those surfaces show plain node text, not a tab-specific title.

    An adversarial review caught two real follow-up issues, both fixed before merge: collections.svelte.ts was running stripMarkdown over the resolved value unconditionally (would have mangled a template-computed title containing _/*/backtick), and the "unresolved title" guard used ASCII-only \w (misclassified a fully-resolved non-Latin-script title, e.g. CJK/Arabic, as unresolved) — resolveDisplayTitle now takes an optional formatContent callback applied only to content-sourced values, and the guard uses a Unicode-aware [\p{L}\p{N}] test.

    Added regression tests reproducing the exact stale-title scenario across all fixed surfaces, plus unit coverage for the shared helper and both review fixes. Full frontend suite green (226 files / 4767 tests) and the pre-push gate (frontend + Rust + e2e + Tauri-seam integration) passed.

  5. removed their assignment
    on Sep 4, 2026
  6. malibio commented on Sep 4, 2026

    @malibio
    CollaboratorAuthor

    Disregard the assignment/status churn on this issue today — I picked it up from a stale local checkout without noticing it had already been closed by #2179 (merged 2026-08-20). No branch was pushed and no PR opened; the local worktree has been discarded. Unassigning and reverting status to Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions