From 98d7dda57992ccd20b93eaf85bcf35ac802b0b3f Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Wed, 5 Apr 2023 11:47:36 +0200 Subject: [PATCH] reset internalState.currentSubscriptions on `resetApiState` --- .../toolkit/src/query/core/buildMiddleware/batchActions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/toolkit/src/query/core/buildMiddleware/batchActions.ts b/packages/toolkit/src/query/core/buildMiddleware/batchActions.ts index 549ade7084..f3ce76d387 100644 --- a/packages/toolkit/src/query/core/buildMiddleware/batchActions.ts +++ b/packages/toolkit/src/query/core/buildMiddleware/batchActions.ts @@ -102,6 +102,11 @@ export const buildBatchedActionsHandler: InternalHandlerBuilder< ) } + if (api.util.resetApiState.match(action)) { + previousSubscriptions = internalState.currentSubscriptions = {} + return [true, false] + } + // Intercept requests by hooks to see if they're subscribed // Necessary because we delay updating store state to the end of the tick if (api.internalActions.internal_probeSubscription.match(action)) {