Skip to content

Add saved session navigation and deletion - #336

Merged
NishiPhalke merged 32 commits into
mainfrom
navigation_and_sessions
Oct 16, 2026
Merged

NishiPhalke merged 32 commits into
mainfrom
navigation_and_sessions

Conversation

@NishiPhalke

@NishiPhalke NishiPhalke commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add a saved-session list to the browser's Sessions panel. Clicking a name opens /browser/[sessionId] and restores its saved state. Delete icons remove sessions, while local is protected in both the UI and API. Deleting the current session opens /browser/local.

SessionPanel.tsx owns the list and navigation. The server's routes and SQLite repository list and remove saved snapshots. BrowserServer.tsx and persistence.ts pause autosave, wait for any outstanding save before deletion, and resume saving if deletion fails.

Workspace verification passed with pnpm verify --concurrency=1. React Doctor reports 100/100 with no issues. The session list uses SWR for shared caching, focus refresh, and cache updates after deletion. Render budgets are unchanged:

SessionPanel interaction Before After
Region change 0 0
Session names arrive 1 1
Delete another session 2 2

Session selection finishes queued and in-flight autosaves through persistence.flush() before replacing the keyed stores. Edits arriving during a PUT receive their own save acknowledgement before navigation. A failed save keeps the current session open with its edits and an error; selecting the destination again retries. Next Link's onNavigate intercepts same-tab navigation while preserving modified-click behavior.

Four integration scenarios cover queued and delayed writes, edits during writes, failure, retry, and restoration after returning. Existing render budgets remain unchanged. New pending-switch budget:

Interaction Before After
Select another session while a save is pending Uncovered 1 (disable navigation while saving)

Manual verification

  1. Run pnpm dev, open /browser/testsession and /browser/niship, and wait for Saved.
  2. Select a session in the Sessions panel and check that its URL and saved state are restored.
  3. Delete another session and verify that the current session stays open.
  4. Delete the current session and verify that /browser/local opens. The local session has no delete icon.

Reopening the mounted Sessions panel revalidates the saved list, including sessions added or removed in another tab. The session list scrolls within its panel so every saved name and delete button stays reachable.

Interaction Before After
Reopen Sessions with external list changes 1 (stale list) 2 (reopening + refreshed names)

The regression test toggles the real workspace panel store, verifies no request on closing and one on reopening, checks additions/removals, and confirms the list stays mounted.

Persistence is initialized only after restoration, snapshot capture, and store subscriptions succeed. A regression test covers a schema-valid snapshot with an unregistered track type followed by a failed DELETE: the load error and retries remain active, no PUT overwrites the saved session, and remote commands remain disconnected. Workspace verification passes with this recovery case.

Deletion recovery keeps at most one load in flight and prevents restoration after initialization. Regression coverage reproduces two delayed GET responses with an intervening edit, confirms the redundant GET is prevented and the edit persists, and checks recovery when the first GET finishes during a failed DELETE.

Browser toolbar integration and shared interaction icon presentation are reviewed separately in #340.

Addresses #334

JaiiR320 and others added 15 commits October 8, 2026 21:55
Agents call MCP tools with a session ID, and the server delivers each
command to the first tab that opened that session. Each command is one
file under apps/server/src/commands, registered once for both the MCP
tool and the tab's executor, and replies with the whole session snapshot.

Sessions load and save through /api/sessions/:id independently of the
command stream, which Settings can turn off. The browser lives at
/browser/[sessionId], and Next.js rewrites /api and /mcp to the server
in place of the hand-written proxy.
# Conflicts:
#	apps/server/README.md
#	apps/server/src/http/routes.ts
#	apps/server/src/protocol.ts
#	apps/server/src/storage/sessionRepository.ts
#	apps/server/src/storage/sqlite.ts
#	apps/server/test/server.test.ts
#	apps/web/README.md
#	apps/web/app/(workspace)/AppProviders.tsx
#	apps/web/app/(workspace)/browser/SessionPanel.tsx
#	apps/web/browser/BrowserServer.tsx
#	apps/web/browser/persistence.ts
#	apps/web/test/browserSession.test.tsx
#	apps/web/test/commands.test.tsx
@NishiPhalke NishiPhalke added feature New feature or request app The gb app (workspace, server, local and cloud) labels Oct 13, 2026
@NishiPhalke NishiPhalke self-assigned this Oct 13, 2026
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
genomebrowser Ready Ready Preview Oct 16, 2026 1:50pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 3cbaca6.

Comment thread apps/web/app/(workspace)/browser/SessionPanel.tsx Outdated
Comment thread apps/web/app/(workspace)/browser/SessionPanel.tsx
Comment thread apps/web/browser/persistence.ts Outdated
@NishiPhalke NishiPhalke reopened this Oct 15, 2026
Comment thread apps/web/browser/persistence.ts Outdated
Comment thread apps/web/browser/BrowserSession.tsx Outdated
Comment thread apps/web/app/(workspace)/browser/SessionPanel.tsx Outdated
Comment thread apps/web/app/(workspace)/browser/SessionPanel.tsx
@JaiiR320

Copy link
Copy Markdown
Member

One blocker from re-checking the latest commits (4a2aec8): deleting a session still doesn't refresh the sessions list. apps/web/.../SessionPanel.tsx:88 calls mutate with revalidate: false, so the list keeps showing stale data, and an in-flight refresh can be dropped. Could this do a real refetch after the delete, and add a test for it?

@NishiPhalke

Copy link
Copy Markdown
Collaborator Author

One blocker from re-checking the latest commits (4a2aec8): deleting a session still doesn't refresh the sessions list. apps/web/.../SessionPanel.tsx:88 calls mutate with revalidate: false, so the list keeps showing stale data, and an in-flight refresh can be dropped. Could this do a real refetch after the delete, and add a test for it?

Fixed: successful deletion now removes the session from the cache and triggers a fresh GET. Older in-flight responses remain invalidated.

@NishiPhalke
NishiPhalke merged commit 5a1528c into main Oct 16, 2026
5 of 6 checks passed
@NishiPhalke
NishiPhalke deleted the navigation_and_sessions branch October 16, 2026 13:55

This branch was successfully deployed

1 active deployment
Preview — 3cbaca67 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app The gb app (workspace, server, local and cloud) feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants