mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
refactor: remove duplicate session.updated handler from EventContext
This commit is contained in:
1 parent
c574c20ff3
commit
720611e081
1 file changed
-19
@@ -8,7 +8,6 @@ import type { PermissionRequest, PermissionResponse, QuestionRequest, SSEEvent,
|
||||
import { showToast } from '@/lib/toast'
|
||||
import { openCodeEventStream, type EventStreamHealthState } from '@/lib/opencode-event-stream'
|
||||
import { OPENCODE_API_ENDPOINT } from '@/config'
|
||||
import { invalidateSessionListCachesDebounced } from '@/lib/queryInvalidation'
|
||||
import { addToSessionKeyedState, removeFromSessionKeyedState } from '@/lib/sessionKeyedState'
|
||||
|
||||
type PermissionsBySession = Record<string, PermissionRequest[]>
|
||||
@@ -499,24 +498,6 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
})
|
||||
}
|
||||
break
|
||||
case 'session.updated':
|
||||
if ('info' in event.properties) {
|
||||
const sessionInfo = event.properties.info as { id: string }
|
||||
// Update single-session cache entries
|
||||
const cache = queryClient.getQueryCache()
|
||||
for (const query of cache.getAll()) {
|
||||
const key = query.queryKey
|
||||
if (key[0] === 'opencode' && key[1] === 'session' && key.length >= 5) {
|
||||
const sessionData = query.state.data as { id: string } | undefined
|
||||
if (sessionData?.id === sessionInfo.id) {
|
||||
queryClient.setQueryData(key, sessionInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Invalidate session list caches instead of mutating infinite-query data
|
||||
invalidateSessionListCachesDebounced(queryClient)
|
||||
}
|
||||
break
|
||||
case 'lsp.updated':
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['opencode', 'lsp']
|
||||
|
||||
Reference in new issue
Block a user