Skip to content

fix deleted session hang and ram leak#1597

Open
Myestery wants to merge 1 commit intodifferent-ai:devfrom
Myestery:fix/deleted-session-tab-hang
Open

fix deleted session hang and ram leak#1597
Myestery wants to merge 1 commit intodifferent-ai:devfrom
Myestery:fix/deleted-session-tab-hang

Conversation

@Myestery
Copy link
Copy Markdown

@Myestery Myestery commented Apr 28, 2026

Closes #1598

Summary

  • Deleting the active session left SessionPage mounted on the dead id; the 3s title poll swallowed 404s and the workspace event sync stayed subscribed → UI hang + unbounded RAM growth when the stale tab was clicked again.
  • onDeleteSession now optimistically filters the session from the sidebar list and navigates to /session (when active) before the HTTP DELETE, so trackWorkspaceSessionSync cleanup fires immediately and React Query caches drop. refreshRouteState still reconciles afterwards.
  • refreshSelectedSessionTitle treats 404 / missing item as deletion: cancels the interval, removes the session from the sidebar list, and navigates back to /session instead of polling forever.

Test plan

  • Open session A, delete it from the sidebar while active → URL flips to /session, sidebar entry disappears immediately, no further getSession requests for A in network tab.
  • With session B active, delete background session A → A vanishes from sidebar instantly; cannot click it.
  • Manually navigate to /session/{nonexistent-id} → route auto-redirects to /session after first 404; no infinite poll.
  • Sit on /session/{deleted} for 1 minute (forced) → heap stable in Chrome devtools Memory.
  • pnpm typecheck in apps/app passes.

Before

hanging.mp4

After

fixed.mp4

When the active session was deleted, SessionPage stayed mounted on the
dead id. The 3s title poll swallowed 404s and kept running, the workspace
event sync stayed subscribed, and the sidebar showed the stale entry
during the refetch window — so clicking it remounted against a missing
session and pinned the UI.

onDeleteSession now optimistically filters the session out of the
sidebar list and navigates to /session (when the deleted session was
active) before issuing the HTTP DELETE. Navigating synchronously flips
selectedSessionId to null, which fires trackWorkspaceSessionSync
cleanup and drops the React Query caches. refreshRouteState still runs
afterwards to reconcile with the server.

refreshSelectedSessionTitle now treats a 404 (or missing item) as a
deleted session: it cancels the interval, removes the session from the
sidebar list, and navigates back to /session instead of looping forever.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Apr 28, 2026 11:01pm

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

@Myestery is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

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.

Deleted session tab hangs app and leaks RAM when clicked

1 participant