Skip to content

fix(app): stop archive from reopening a recent session#35416

Open
minh2416294 wants to merge 1 commit into
anomalyco:devfrom
minh2416294:archive-session-nav
Open

fix(app): stop archive from reopening a recent session#35416
minh2416294 wants to merge 1 commit into
anomalyco:devfrom
minh2416294:archive-session-nav

Conversation

@minh2416294

@minh2416294 minh2416294 commented Jul 5, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #35058

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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.

archiveSession picked 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 sibling deleteSession already filtered those out, so the two had drifted.

I extracted selectNextSessionAfterRemoval into session/helpers.ts. It only treats root, non-archived sessions as navigation candidates, so archiving a lone session returns undefined and the view falls through to the empty/draft state. Both archiveSession and deleteSession call it now, so the logic can't drift again.

How did you verify your code works?

cd packages/app && bun run test:unit is green (520 pass). I added 6 tests to helpers.test.ts covering the lone-root case, child/archived exclusion, and neighbor selection. Removing the filter turns 3 of them red, so they pin the bug. bun typecheck shows no new errors in the changed files.

Screenshots / recordings

N/A — no visual change; the fix is navigation behavior after archiving.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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>
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Archived Sessions Do Not Close Tabs and Reopen Recent Session(归档会话未能关闭标签页,还重新打开最近会话)

1 participant