Skip to content

fix(dockview-core): keep tab renderer params in sync with setTitle (#914)#1289

Merged
mathuo merged 1 commit into
masterfrom
fix/914-overflow-dropdown-title-sync
May 16, 2026
Merged

fix(dockview-core): keep tab renderer params in sync with setTitle (#914)#1289
mathuo merged 1 commit into
masterfrom
fix/914-overflow-dropdown-title-sync

Conversation

@mathuo
Copy link
Copy Markdown
Owner

@mathuo mathuo commented May 16, 2026

Summary

Fixes #914 — the header overflow dropdown lazily builds a fresh tab renderer for each overflowed panel via panel.view.createTabRenderer(...). That renderer is initialised from DockviewPanelModel._params, a snapshot captured once at panel init. api.setTitle(...) only updated DockviewPanel._title and fired onDidTitleChange, so the lazy-built tab read the stale original title and the title-change event never fired after construction.

  • Add a small setTitle(title) hook on IDockviewPanelModel / DockviewPanelModel that updates the cached _params.title.
  • Call it from DockviewPanel.setTitle(...) so the model's snapshot stays current.

This is approach (A) from the triage report — the smallest diff that keeps _params as the canonical source of truth. Anyone supplying a custom tab component via createTabComponent (whose ephemeral renderer reads params.title in init) also benefits.

Test plan

  • New regression test issue #914: api.setTitle reflected by createTabRenderer output in dockviewComponent.spec.ts exercises the bug directly: add a panel with title 'original', call api.setTitle('renamed'), invoke panel.view.createTabRenderer('headerOverflow'), and assert the rendered tab's textContent contains 'renamed' and not 'original'.
  • Verified the new test fails on master without the fix (received "original", expected to contain "renamed").
  • npx jest --testPathPatterns dockviewComponent.spec --testNamePattern "title" — 3 passed.
  • npx jest --testPathPatterns dockviewPanelModel — 6 passed.
  • Full dockview-core suite: 906 / 906 pass.

🤖 Generated with Claude Code

)

The header overflow dropdown lazily constructs a fresh tab renderer for
each overflowed panel via `panel.view.createTabRenderer(...)`. That
renderer is initialised with `DockviewPanelModel._params`, a snapshot of
the panel's init parameters captured once and never refreshed. Calling
`api.setTitle(...)` updated `DockviewPanel._title` and fired
`onDidTitleChange`, but did not update the model's cached params — so a
freshly-built tab read the stale original title and never saw a
title-change event (the change had already happened before init).

Fix by syncing the model's cached params from `DockviewPanel.setTitle`
via a small new `IDockviewPanelModel.setTitle(title)` hook. Approach A
from the triage report: smaller diff than threading the live panel
title through `createTabRenderer`, keeps `_params` as the canonical
source of truth, and any future code path reading `_params.title`
benefits too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mathuo mathuo merged commit 34eb1f3 into master May 16, 2026
6 checks passed
@sonarqubecloud
Copy link
Copy Markdown

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.

Tab overflow dropdown does not reflect updated title set via api.setTitle

1 participant