Files
opencode-manager/frontend/src/lib/sessionKey.ts
T
Chris Scott 2d14972fad 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
2026-10-08 14:36:26 -04:00

16 lines
526 B
TypeScript

import type { Session } from '@/api/types'
export function buildSessionKey(directory: string | undefined, id: string): string {
return `${directory ?? ''}:${id}`
}
export function getSessionKey(session: Pick<Session, 'id' | 'location'>): string {
return buildSessionKey(session.location.directory, session.id)
}
export function buildPinnedSessionKeys(
pins: ReadonlyArray<{ directory: string; sessionId: string }>,
): Set<string> {
return new Set(pins.map((pin) => buildSessionKey(pin.directory, pin.sessionId)))
}