Skip to content

Commit

Permalink
changed polling test name to represent actual behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
riqts committed Jan 24, 2024
1 parent 65b448f commit b9d37c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/toolkit/src/query/core/buildMiddleware/polling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ export const buildPollingHandler: InternalHandlerBuilder = ({
subscribers[key].pollingInterval!,
lowestPollingInterval
)
// if (!skipPollOnFocusLost) {
skipPollOnFocusLost = subscribers[key].skipPollOnFocusLost
// }
skipPollOnFocusLost = subscribers[key].skipPollOnFocusLost
}
}

Expand Down
3 changes: 1 addition & 2 deletions packages/toolkit/src/query/tests/polling.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit b9d37c3

Please sign in to comment.