mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import { useEffect, useRef, useCallback } from "react";
|
||||
import { connectSSE, disconnectSSE } from "../api/sse";
|
||||
import type { SessionEvent } from "../types";
|
||||
import { useEffect, useRef, useCallback } from 'react'
|
||||
import { connectSSE, disconnectSSE } from '../api/sse'
|
||||
import type { SessionEvent } from '../types'
|
||||
|
||||
export function useSSE(
|
||||
sessionId: string | null,
|
||||
onEvent: (event: SessionEvent) => void,
|
||||
) {
|
||||
const onEventRef = useRef(onEvent);
|
||||
onEventRef.current = onEvent;
|
||||
const onEventRef = useRef(onEvent)
|
||||
onEventRef.current = onEvent
|
||||
|
||||
const stableCallback = useCallback((event: SessionEvent) => {
|
||||
onEventRef.current(event);
|
||||
}, []);
|
||||
onEventRef.current(event)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!sessionId) return;
|
||||
if (!sessionId) return
|
||||
|
||||
connectSSE(sessionId, stableCallback);
|
||||
connectSSE(sessionId, stableCallback)
|
||||
|
||||
return () => {
|
||||
disconnectSSE();
|
||||
};
|
||||
}, [sessionId, stableCallback]);
|
||||
disconnectSSE()
|
||||
}
|
||||
}, [sessionId, stableCallback])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user