From b6655fe083c090286f69127c435973bd41baf595 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 27 Jun 2025 19:59:21 +0200 Subject: [PATCH] Use the client hash only in `useEffect` --- libs/sdk-js/src/react/stream.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/sdk-js/src/react/stream.tsx b/libs/sdk-js/src/react/stream.tsx index 5493fae2f..8ac73ca9e 100644 --- a/libs/sdk-js/src/react/stream.tsx +++ b/libs/sdk-js/src/react/stream.tsx @@ -321,11 +321,10 @@ function useThreadHistory>( ) { const [history, setHistory] = useState[]>([]); + const clientHash = getClientConfigHash(client); const clientRef = useRef(client); clientRef.current = client; - const clientHash = getClientConfigHash(client); - const fetcher = useCallback( ( threadId: string | undefined | null, @@ -342,13 +341,13 @@ function useThreadHistory>( clearCallbackRef.current?.(); return Promise.resolve([]); }, - [clientHash], + [], ); useEffect(() => { if (submittingRef.current) return; fetcher(threadId); - }, [fetcher, submittingRef, threadId]); + }, [fetcher, clientHash, submittingRef, threadId]); return { data: history,