mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-07 18:27:52 +02:00
Use the client hash only in useEffect
This commit is contained in:
@@ -321,11 +321,10 @@ function useThreadHistory<StateType extends Record<string, unknown>>(
|
||||
) {
|
||||
const [history, setHistory] = useState<ThreadState<StateType>[]>([]);
|
||||
|
||||
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<StateType extends Record<string, unknown>>(
|
||||
clearCallbackRef.current?.();
|
||||
return Promise.resolve([]);
|
||||
},
|
||||
[clientHash],
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (submittingRef.current) return;
|
||||
fetcher(threadId);
|
||||
}, [fetcher, submittingRef, threadId]);
|
||||
}, [fetcher, clientHash, submittingRef, threadId]);
|
||||
|
||||
return {
|
||||
data: history,
|
||||
|
||||
Reference in New Issue
Block a user