Skip to content

Commit 849c98d

Browse files
committed
Only remove promise in query hook if the subscription was removed
1 parent 0ebdbfa commit 849c98d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/toolkit/src/query/react/buildHooks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,9 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
740740
})
741741

742742
usePossiblyImmediateEffect((): void | undefined => {
743-
promiseRef.current = undefined
743+
if (subscriptionRemoved) {
744+
promiseRef.current = undefined
745+
}
744746
}, [subscriptionRemoved])
745747

746748
usePossiblyImmediateEffect((): void | undefined => {

0 commit comments

Comments
 (0)