fix(sessions): refresh transcript when returning to a session

The transcript cache is never re-read when a mounted session page switches to
another session or is returned to, so a session that finished while the user was
away kept showing its stop button and treated new prompts as queued. Re-read the
newest page whenever the session subscription starts with an existing cache, and
drop refetchOnMount so a mount performs a single read.
This commit is contained in:
Chris Scott committed 2026-10-12 01:08:58 +00:00
1 parent 2e2eff05af
commit 5dbf9766a5
2 files changed
+113 -1

No files matched your search

+4 -1
View File
@@ -83,7 +83,6 @@ export function useSessionTranscript(sessionID: string, directory: string) {
enabled: Boolean(sessionID && directory),
staleTime: Infinity,
refetchOnWindowFocus: false,
refetchOnMount: 'always',
refetchInterval: isStreamConnected ? false : TRANSCRIPT_FALLBACK_POLL_INTERVAL_MS,
})
@@ -155,6 +154,10 @@ export function useSessionTranscript(sessionID: string, directory: string) {
onResync: refreshNewestPage,
})
if (queryClient.getQueryData<TranscriptCache>(queryKey)) {
refreshNewestPage()
}
return () => {
if (frameRef.current !== null) {
cancelAnimationFrame(frameRef.current)