mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
Add session ID filter to SSE error handling
This commit is contained in:
1 parent
607e824613
commit
7ba2cf2328
2 files changed
+4
-3
No files matched your search
@@ -39,7 +39,7 @@ const handleRestartServer = async () => {
|
||||
}
|
||||
|
||||
|
||||
export const useSSE = (opcodeUrl: string | null | undefined, directory?: string) => {
|
||||
export const useSSE = (opcodeUrl: string | null | undefined, directory?: string, currentSessionId?: string) => {
|
||||
const client = useOpenCodeClient(opcodeUrl, directory)
|
||||
const queryClient = useQueryClient()
|
||||
const mountedRef = useRef(true)
|
||||
@@ -292,6 +292,7 @@ export const useSSE = (opcodeUrl: string | null | undefined, directory?: string)
|
||||
|
||||
case 'session.error': {
|
||||
if (!('error' in event.properties)) break
|
||||
if ('sessionID' in event.properties && event.properties.sessionID === currentSessionId) break
|
||||
|
||||
const parsed = parseOpenCodeError(event.properties.error)
|
||||
if (parsed) {
|
||||
@@ -306,7 +307,7 @@ export const useSSE = (opcodeUrl: string | null | undefined, directory?: string)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}, [queryClient, opcodeUrl, directory, setSessionStatus, setSessionTodos])
|
||||
}, [queryClient, opcodeUrl, directory, setSessionStatus, setSessionTodos, currentSessionId])
|
||||
|
||||
const fetchInitialData = useCallback(async () => {
|
||||
if (!client || !mountedRef.current) return
|
||||
|
||||
@@ -112,7 +112,7 @@ export function SessionDetail() {
|
||||
onScrollStateChange: setShowScrollButton
|
||||
});
|
||||
|
||||
const { isConnected, isReconnecting } = useSSE(opcodeUrl, repoDirectory);
|
||||
const { isConnected, isReconnecting } = useSSE(opcodeUrl, repoDirectory, sessionId);
|
||||
const abortSession = useAbortSession(opcodeUrl, repoDirectory, sessionId);
|
||||
const updateSession = useUpdateSession(opcodeUrl, repoDirectory);
|
||||
const createSession = useCreateSession(opcodeUrl, repoDirectory);
|
||||
|
||||
Reference in new issue
Block a user