fix(app): stop archive from reopening a recent session#35416
Open
minh2416294 wants to merge 1 commit into
Open
fix(app): stop archive from reopening a recent session#35416minh2416294 wants to merge 1 commit into
minh2416294 wants to merge 1 commit into
Conversation
archiving the only open session picked an unfiltered neighbor (a child or already-archived session) instead of closing the tab, so a recent session reopened. pulled the next-session pick into selectNextSessionAfterRemoval which only looks at root non-archived sessions, and pointed both archiveSession and deleteSession at it. Signed-off-by: Minhkunn <minh.12072k6@gmail.com>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #35058
Type of change
What does this PR do?
Archiving a session was reopening a recent session instead of closing the tab. When you archive the only open session in a project, the tab did not close and the most-recently-used session reopened.
archiveSessionpicked the "next session to navigate to" from the unfiltered session list, which still contains child sessions and already-archived sessions, so it always found a neighbor to navigate into. The siblingdeleteSessionalready filtered those out, so the two had drifted.I extracted
selectNextSessionAfterRemovalintosession/helpers.ts. It only treats root, non-archived sessions as navigation candidates, so archiving a lone session returnsundefinedand the view falls through to the empty/draft state. BotharchiveSessionanddeleteSessioncall it now, so the logic can't drift again.How did you verify your code works?
cd packages/app && bun run test:unitis green (520 pass). I added 6 tests tohelpers.test.tscovering the lone-root case, child/archived exclusion, and neighbor selection. Removing the filter turns 3 of them red, so they pin the bug.bun typecheckshows no new errors in the changed files.Screenshots / recordings
N/A — no visual change; the fix is navigation behavior after archiving.
Checklist