mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
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:
1 parent
2e2eff05af
commit
5dbf9766a5
2 files changed
+113
-1
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user