mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Fix session caching - enable refetch on focus and reconnect
This commit is contained in:
1 parent
08e3414677
commit
ec1d96a77d
3 files changed
+11
-6
No files matched your search
@@ -85,7 +85,7 @@ A full-stack web application for running [OpenCode](https://github.com/sst/openc
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/yourusername/opencode-webui.git
|
||||
git clone https://github.com/cstech-dev/opencode-webui.git
|
||||
cd opencode-webui
|
||||
|
||||
# Start with Docker Compose (single container)
|
||||
@@ -125,7 +125,7 @@ docker exec -it opencode-web sh
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/yourusername/opencode-webui.git
|
||||
git clone https://github.com/cstech-dev/opencode-webui.git
|
||||
cd opencode-webui
|
||||
|
||||
# Install dependencies (uses Bun workspaces)
|
||||
|
||||
@@ -28,6 +28,9 @@ export const useSessions = (opcodeUrl: string | null | undefined, directory?: st
|
||||
queryKey: ["opencode", "sessions", opcodeUrl, directory],
|
||||
queryFn: () => client!.listSessions(),
|
||||
enabled: !!client,
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
staleTime: 10000,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -38,6 +41,9 @@ export const useSession = (opcodeUrl: string | null | undefined, sessionID: stri
|
||||
queryKey: ["opencode", "session", opcodeUrl, sessionID, directory],
|
||||
queryFn: () => client!.getSession(sessionID!),
|
||||
enabled: !!client && !!sessionID,
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
staleTime: 15000,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -49,8 +55,9 @@ export const useMessages = (opcodeUrl: string | null | undefined, sessionID: str
|
||||
queryFn: () => client!.listMessages(sessionID!),
|
||||
enabled: !!client && !!sessionID,
|
||||
refetchOnMount: false,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
staleTime: 30000,
|
||||
gcTime: 10 * 60 * 1000,
|
||||
placeholderData: (previousData) => previousData,
|
||||
});
|
||||
|
||||
@@ -333,8 +333,6 @@ export const useSSE = (opcodeUrl: string | null | undefined, directory?: string)
|
||||
setIsConnected(true)
|
||||
setError(null)
|
||||
resetReconnectDelay()
|
||||
queryClient.invalidateQueries({ queryKey: ['opencode', 'sessions', opcodeUrl, directory] })
|
||||
queryClient.invalidateQueries({ queryKey: ['opencode', 'messages', opcodeUrl] })
|
||||
}
|
||||
|
||||
eventSource.onerror = () => {
|
||||
|
||||
Reference in new issue
Block a user