chore remove sse debug logging

This commit is contained in:
ShukeBta
2026-06-30 20:24:40 +08:00
parent 941bb273b9
commit 7cf0e468ff
+1 -8
View File
@@ -16,7 +16,7 @@ type SSEEventHandler = (event: SSEEvent) => void
* function MyComponent() {
* const { connect, disconnect } = useSSE((event) => {
* if (event.type === 'scan') {
* console.log('Scan progress:', event.payload)
* updateScanProgress(event.payload)
* }
* })
*
@@ -59,7 +59,6 @@ export function useSSE(
eventSource.onopen = () => {
isConnectedRef.current = true
reconnectAttemptsRef.current = 0
console.log('SSE connected')
}
eventSource.onmessage = (event) => {
@@ -79,18 +78,12 @@ export function useSSE(
if (reconnectAttemptsRef.current < maxReconnectAttempts) {
const delay = Math.min(1000 * Math.pow(2, reconnectAttemptsRef.current), 30000)
reconnectAttemptsRef.current++
console.log(`SSE reconnecting in ${delay}ms (attempt ${reconnectAttemptsRef.current})`)
reconnectTimeoutRef.current = setTimeout(connect, delay)
} else {
console.error('SSE connection failed after max attempts')
}
}
// 自定义事件类型
eventSource.addEventListener('connected', (event) => {
console.log('SSE handshake received:', event)
})
}, [onEvent])
const disconnect = useCallback(() => {