Skip to content

Commit

Permalink
Only remove promise in query hook if the subscription was removed
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Feb 20, 2023
1 parent 0ebdbfa commit 849c98d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/toolkit/src/query/react/buildHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
})

usePossiblyImmediateEffect((): void | undefined => {
promiseRef.current = undefined
if (subscriptionRemoved) {
promiseRef.current = undefined
}
}, [subscriptionRemoved])

usePossiblyImmediateEffect((): void | undefined => {
Expand Down

0 comments on commit 849c98d

Please sign in to comment.