fix(sessions): address PR #403 review findings

- fetch picker sessions only while the dialog is open
- list all-projects sessions with one request per page
- block infinite-scroll paging while a search is pending
- memoize picker rows with stable callbacks
- remove deleted sessions from list caches instead of refetching
- keep the repo tab when the open session is deleted
- reuse useSessionSearch in the sidebar session tree
- drop dead activeSessionID/isActive and share delete, session-key and repo-map helpers
- move usePersistentBoolean to its own hook
This commit is contained in:
Chris Scott committed 2026-10-08 14:36:26 -04:00
1 parent 85288d6393
commit 2d14972fad
24 files changed
+814 -412

No files matched your search

+2 -4
View File
@@ -3,7 +3,7 @@ import { useQueries, useQuery } from '@tanstack/react-query'
import { listRepos } from '@/api/repos'
import { sessionQueryOptions, useSessionsAcrossDirectories } from '@/hooks/useOpenCode'
import { useSessionPins } from '@/hooks/useSessionPins'
import { buildPinnedSessionKeys, buildSessionKey } from '@/lib/sessionKey'
import { buildPinnedSessionKeys, buildSessionKey, getSessionKey } from '@/lib/sessionKey'
import type { Repo, Session } from '@/api/types'
import {
SIDEBAR_SESSIONS_PER_REPO,
@@ -46,9 +46,7 @@ export function useSidebarRepoGroups(input: {
const missingPins = useMemo(() => {
if (search) return []
const repoDirectories = new Set(directories)
const fetchedKeys = new Set(
sessions.map((session) => buildSessionKey(session.location.directory, session.id)),
)
const fetchedKeys = new Set(sessions.map(getSessionKey))
return (sessionPins ?? []).filter(
(pin) =>
repoDirectories.has(pin.directory) &&