🤖 feat: parent-tab tracking for file preview close navigation#2660
🤖 feat: parent-tab tracking for file preview close navigation#2660ibetitsmike wants to merge 3 commits intomainfrom
Conversation
When a file preview tab is opened from another tab (e.g., review or explorer), closing the file tab now returns focus to the originating tab instead of falling back to positional adjacency. - Add parentTab map to RightSidebarLayoutState - Update removeTabFromNode/removeTabEverywhere to prefer parent tab - Record parent tab in handleOpenFile - Clean up stale entries on tab removal - Add 7 tests for parent-tab behavior and backward compat
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b2917413e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
When a file that's already open is selected again from a different tab (e.g., originally from Review, later from Explorer), update the parentTab entry to reflect the most recent origin so close navigates correctly.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd8af75fe0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Avoid writing cross-tabset parents that can never be activated on close. When re-selecting an already-open file from a different tabset, the parentTab entry is left unchanged to preserve the existing (usable) parent rather than overwriting it with an unreachable cross-tabset tab.
|
@codex review Addressed the cross-tabset parentTab overwrite issue — now only refreshes parentTab when the origin tab is in the same tabset as the file tab. Cross-tabset origins are left unchanged to preserve the existing usable parent. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
When a file preview tab is opened from another tab (e.g., Review or Explorer), closing the file now returns focus to the tab that opened it instead of falling back to whichever tab happens to be positionally adjacent.
Background
File preview tabs are opened from the Review or Explorer panels. When the user closes a file preview, the previous behavior picked the next (or previous) tab in the array — which is disorienting because the user expects to return to where they came from. This change adds a "parent tab" concept so closing a file navigates back naturally.
Implementation
Adds an optional
parentTabmap (Record<string, string>) toRightSidebarLayoutStateas a side-channel alongside the existing tree structure. This avoids changing the recursiveRightSidebarLayoutNodetree.rightSidebarLayout.ts:RightSidebarLayoutStateinterface with optionalparentTabfieldremoveTabFromNode()now accepts an optionalpreferredActiveTab— when the active tab is removed and a parent exists in the same tabset, it's activated instead of positional fallbackremoveTabEverywhere()looks up the parent before removal, passes it through, and cleans up stale entries (both for the removed tab and any orphaned children pointing to it)isRightSidebarLayoutState()validator accepts the optionalparentTabfield for backward compatRightSidebar.tsx:handleOpenFilenow records the currently active tab as the parent of the new file tabTests (7 new):
Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh• Cost:$3.65