diff --git a/packages/toolkit/src/query/react/buildHooks.ts b/packages/toolkit/src/query/react/buildHooks.ts index 9bd297b02f..9923b23990 100644 --- a/packages/toolkit/src/query/react/buildHooks.ts +++ b/packages/toolkit/src/query/react/buildHooks.ts @@ -65,10 +65,7 @@ import { useStableQueryArgs } from './useSerializedStableValue' import { useShallowStableValue } from './useShallowStableValue' import type { InfiniteQueryDirection } from '../core/apiState' import { isInfiniteQueryDefinition } from '../endpointDefinitions' -import { - StartInfiniteQueryActionCreatorOptions, - StartInfiniteQueryActionCreator, -} from '../core/buildInitiate' +import { StartInfiniteQueryActionCreator } from '../core/buildInitiate' // Copy-pasted from React-Redux const canUseDOM = () => @@ -1647,7 +1644,8 @@ export function buildHooks({ useEffect(() => { return () => { promiseRef.current?.unsubscribe?.() - promiseRef.current = undefined + // eslint-disable-next-line react-hooks/exhaustive-deps + ;(promiseRef.current as any) = undefined } }, [promiseRef]) }