Skip to content

fix(app): refresh v2 tab titles#30335

Open
gzb1128 wants to merge 1 commit into
anomalyco:devfrom
gzb1128:fix/app-v2-tab-title-refresh
Open

fix(app): refresh v2 tab titles#30335
gzb1128 wants to merge 1 commit into
anomalyco:devfrom
gzb1128:fix/app-v2-tab-title-refresh

Conversation

@gzb1128
Copy link
Copy Markdown

@gzb1128 gzb1128 commented Jun 2, 2026

Issue for this PR

Fixes #30329

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes the v2 layout tab bar not refreshing when the model generates a session title.

Root cause: mapArray runs its mapper inside untrack, so reading session.title inside the mapper creates no reactive subscription. When the store is later updated via reconcile (in the session.updated SSE handler), the mapped result stays stale.

Fix: Extract tab enrichment into createTitlebarTabsEnriched() (titlebar-tabs.ts). Instead of eagerly reading session data inside the untracked mapper, the helper stores the session accessor and exposes title as a reactive getter:

const base = mapArray(() => tabsStore, (tab) => {
  const info = sessionForTab(tab)  // accessor, not value
  return { ...tab, info, title: () => info()?.title }
})
return () => base().filter((tab) => tab.info())

The <For> render function now calls tab.title() and tab.info() under a tracking scope, so updates propagate correctly.

How did you verify your code works?

  • Reproduced the regression: old mapper captures session.title as a static snapshot, test asserts stale value
  • bun test --preload ./happydom.ts ./src/components/titlebar.test.ts from packages/app: 1 pass
  • bun typecheck from packages/app: no new errors (pre-existing message-timeline.tsx error unrelated)
  • git diff --check: clean

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@gzb1128 gzb1128 requested a review from adamdotdevin as a code owner June 2, 2026 06:24
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(app): v2 tab bar does not refresh when session title is generated

1 participant