fix(dockview-core): keep tab renderer params in sync with setTitle (#914)#1289
Merged
Conversation
) 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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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 fromDockviewPanelModel._params, a snapshot captured once at panel init.api.setTitle(...)only updatedDockviewPanel._titleand firedonDidTitleChange, so the lazy-built tab read the stale original title and the title-change event never fired after construction.setTitle(title)hook onIDockviewPanelModel/DockviewPanelModelthat updates the cached_params.title.DockviewPanel.setTitle(...)so the model's snapshot stays current.This is approach (A) from the triage report — the smallest diff that keeps
_paramsas the canonical source of truth. Anyone supplying a custom tab component viacreateTabComponent(whose ephemeral renderer readsparams.titleininit) also benefits.Test plan
issue #914: api.setTitle reflected by createTabRenderer outputindockviewComponent.spec.tsexercises the bug directly: add a panel with title'original', callapi.setTitle('renamed'), invokepanel.view.createTabRenderer('headerOverflow'), and assert the rendered tab'stextContentcontains'renamed'and not'original'."original", expected to contain"renamed").npx jest --testPathPatterns dockviewComponent.spec --testNamePattern "title"— 3 passed.npx jest --testPathPatterns dockviewPanelModel— 6 passed.dockview-coresuite: 906 / 906 pass.🤖 Generated with Claude Code