diff --git a/src/react-hooks/buildHooks.ts b/src/react-hooks/buildHooks.ts index 30d8fe25..cefa1c69 100644 --- a/src/react-hooks/buildHooks.ts +++ b/src/react-hooks/buildHooks.ts @@ -214,7 +214,11 @@ export function buildHooks({ ]); useEffect(() => { - return () => void promiseRef.current?.unsubscribe(); + return () => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + promiseRef.current?.unsubscribe(); + promiseRef.current = undefined; + }; }, []); return useMemo( @@ -280,7 +284,13 @@ export function buildHooks({ const promiseRef = useRef>(); - useEffect(() => () => void promiseRef.current?.unsubscribe(), []); + useEffect(() => { + return () => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + promiseRef.current?.unsubscribe(); + promiseRef.current = undefined; + }; + }, []); const triggerMutation = useCallback( function (args) {