From b9d37c3d56157b9b99daaff4fae3ce4e59c54491 Mon Sep 17 00:00:00 2001 From: Jackson Date: Fri, 12 Jan 2024 00:05:06 +1100 Subject: [PATCH] changed polling test name to represent actual behaviour --- packages/toolkit/src/query/core/buildMiddleware/polling.ts | 4 +--- packages/toolkit/src/query/tests/polling.test.tsx | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/toolkit/src/query/core/buildMiddleware/polling.ts b/packages/toolkit/src/query/core/buildMiddleware/polling.ts index 909aa94219..c91d161c95 100644 --- a/packages/toolkit/src/query/core/buildMiddleware/polling.ts +++ b/packages/toolkit/src/query/core/buildMiddleware/polling.ts @@ -135,9 +135,7 @@ export const buildPollingHandler: InternalHandlerBuilder = ({ subscribers[key].pollingInterval!, lowestPollingInterval ) - // if (!skipPollOnFocusLost) { - skipPollOnFocusLost = subscribers[key].skipPollOnFocusLost - // } + skipPollOnFocusLost = subscribers[key].skipPollOnFocusLost } } diff --git a/packages/toolkit/src/query/tests/polling.test.tsx b/packages/toolkit/src/query/tests/polling.test.tsx index 258fbf7dbe..1f0f400c9a 100644 --- a/packages/toolkit/src/query/tests/polling.test.tsx +++ b/packages/toolkit/src/query/tests/polling.test.tsx @@ -4,7 +4,6 @@ import { setupApiStore } from './helpers' import type { SubscriptionSelectors } from '../core/buildMiddleware/types' import { createListenerMiddleware } from '@reduxjs/toolkit' - const mockBaseQuery = vi .fn() .mockImplementation((args: any) => ({ data: args })) @@ -167,7 +166,7 @@ describe('polling tests', () => { storeListenerRef.store.dispatch(api.util.resetApiState()) }) - it('respects skipPollOnFocusLost if any subscription is true', async () => { + it('respects skipPollOnFocusLost of the most recent mounted subscription', async () => { const listenerMiddleware = createListenerMiddleware() const storeListenerRef = setupApiStore(api, undefined, { middleware: {