[PR #10580] fix(opencode): merge session list to prevent stored sessions retrieval to overwrite active (new) session #13493

Open
opened 2026-02-16 18:18:20 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10580

State: open
Merged: No


With large session counts, the stored sessions retrieval is slower. Creating a session while a request is in-flight causes the UI to disappear when the stored sessions list replaces the store.

The session view depends on sync.session.get(route.sessionID) (index.tsx:114) rendered via <Show when={session()}> (index.tsx:962). When the store is replaced without the new session, session() becomes undefined and the Show renders nothing.

This fix merges the stored sessions with existing sessions instead of replacing, preserving newly-created sessions. Deduplication is covered by usage of Map.

Verification I did:

  • With ~13k sessions, created a new session during an in-flight list request
  • UI no longer disappears or blink when stored sessions response arrives in store

Fixes #10578

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10580 **State:** open **Merged:** No --- With large session counts, the stored sessions retrieval is slower. Creating a session while a request is in-flight causes the UI to disappear when the stored sessions list replaces the store. The session view depends on `sync.session.get(route.sessionID)` (index.tsx:114) rendered via `<Show when={session()}>` (index.tsx:962). When the store is replaced without the new session, `session()` becomes undefined and the `Show` renders nothing. This fix merges the stored sessions with existing sessions instead of replacing, preserving newly-created sessions. Deduplication is covered by usage of Map. Verification I did: - With ~13k sessions, created a new session during an in-flight list request - UI no longer disappears or blink when stored sessions response arrives in store Fixes #10578
yindo added the pull-request label 2026-02-16 18:18:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13493