fix(secondary-panel): return to source tab when closing a tab - #3015
Open
kongenpei wants to merge 1 commit into
Open
fix(secondary-panel): return to source tab when closing a tab#3015kongenpei wants to merge 1 commit into
kongenpei wants to merge 1 commit into
Conversation
When a secondary-panel tab (e.g. a side-chat plugin panel) was closed, focus jumped to the left positional neighbor instead of the tab that was active before the closed tab was opened. Track the most-recently-active prior tab as a transient previousActiveTabId and prefer it on close when it still exists, falling back to the positional neighbor otherwise. Co-authored-by: TRAE CLI <traecli@bytedance.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.
What was wrong
Closing a secondary-panel tab moved focus to the left positional neighbor of the closed tab instead of returning to the tab that was active before the closed tab was opened. With the side-chat plugin this is jarring: open a side chat from a source tab, close it, and you land on an unrelated left-neighbor tab rather than the source tab.
Root cause:
getActiveTabIdAfterCloseinpackages/client-core/src/panel/secondaryPanelTabState.tspicked the next tab purely by position, with no memory of the previously-active tab.Fixes #3014
What changed
previousActiveTabIdon the secondary panel group state. It is recorded whenever activation changes the active tab (only if the prior tab still exists), and preserved across no-op activations/updates.getActiveTabIdAfterClosenow preferspreviousActiveTabIdwhen it still exists and is a file tab; otherwise it falls back to the original positional logic.normalizeFixedSecondaryPanelTabGroupStatebefore serialization, never persisted to localStorage, never synced to the server, and never crosses the host-daemon boundary. NoHOST_DAEMON_PROTOCOL_VERSIONbump required.How verified
secondaryPanelTabState.test.ts: added a return-to-source test and a positional-fallback test (source tab gone), and corrected the existing close assertion to reflect MRU behavior.