Repository navigation
fix(app): ignore collapsed side-panel tabs when closing a tab - #54695
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
The fix works. I reproduced the bug on the base by running the PR's updated review.spec.ts against it: with the side panel collapsed, Ctrl+W left the Alpha review state session tab open. On this branch, e2e/regression/review.spec.ts and e2e/regression/tabs.spec.ts pass (34 tests), and packages/app type-checks cleanly.
Both closeTab and the registration of file.close read closableTab(), so the one guard covers both. The test addition is small and uses auto-waiting assertions only.
Public API: unchanged (this only changes how the app scopes a command internally).
No concerns.
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.
Why
When a session has an unpinned file, context, or search tab selected in the side panel and the user collapses the side panel, pressing
⌘W(Ctrl+W) to close the active session tab fails to close the session tab. Instead,file.closeremains registered for the hidden side-panel tab, and because itswhenguard gives it higher priority thantab.close, each⌘Wsilently closes a hidden side-panel tab in the background before the session tab finally closes.What Changes
closableTab()inuseSessionCommandsnow checksactions.session.layout.view().side.opened()before returning the selected unpinned side-panel tab.file.closeis only registered while the side panel is open.⌘W(Ctrl+W) — Before⌘W(Ctrl+W) — Afterguide.md,Context,Open file)Changestabguide.md,Context,Open file)flowchart TD A["User presses ⌘W / Ctrl+W"] --> B{"Side panel open?<br/>view().side.opened()"} B -- "No (collapsed)" --> C["tab.close closes active session tab"] B -- "Yes (open)" --> D{"Selected side tab unpinned?"} D -- "No (Changes)" --> C D -- "Yes (file / Context / Open file)" --> E{"Focus inside extension scope?"} E -- "No" --> F["file.close closes selected side-panel tab"] E -- "Yes" --> G["Extension-scoped shortcut handles event"]Demo
Side-by-side Playwright capture comparing
origin/dev(03cb9b9946) on the left and this branch (b657c94e89) on the right using a mocked workspace server:side-panel-close-demo.mp4
Scope
This PR scopes
file.close(closableTab()) inpackages/app/src/session/commands/use-session-commands.tsxto require an open side panel and extends the session review state E2E regression test inpackages/app/e2e/regression/review.spec.ts.Verification
bunx playwright test e2e/regression/review.spec.ts e2e/regression/tabs.spec.ts e2e/regression/command-palette.spec.ts bun run --cwd packages/app test:unit bun run checkrestores review state and the side-panel tab per sessionE2E test inpackages/app/e2e/regression/review.spec.tsfails againstorigin/dev([data-titlebar-tab-slot]forAlpha review stateremains at count1after pressingCtrl+Wwith the side panel collapsed) and passes with the fix.e2e/regression/review.spec.ts,e2e/regression/tabs.spec.ts, ande2e/regression/command-palette.spec.ts: 41 passed.packages/appunit suite: 742 passed across 107 files.bun run check: 0 errors across all 36 typecheck and lint tasks.