Skip to content

Commit d1b9971

Browse files
committed
yarn format changes
1 parent bbb89b6 commit d1b9971

File tree

1 file changed

+14
-16
lines changed
  • packages/toolkit/src/query/core/buildMiddleware

1 file changed

+14
-16
lines changed

packages/toolkit/src/query/core/buildMiddleware/polling.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,38 +53,36 @@ export const buildPollingHandler: InternalHandlerBuilder = ({
5353
{ queryCacheKey }: QuerySubstateIdentifier,
5454
api: SubMiddlewareApi
5555
) {
56-
const state = api.getState()[reducerPath];
57-
const querySubState = state.queries[queryCacheKey];
58-
const subscriptions = internalState.currentSubscriptions[queryCacheKey];
56+
const state = api.getState()[reducerPath]
57+
const querySubState = state.queries[queryCacheKey]
58+
const subscriptions = internalState.currentSubscriptions[queryCacheKey]
5959

6060
if (!querySubState || querySubState.status === QueryStatus.uninitialized)
61-
return;
61+
return
6262

63-
const { lowestPollingInterval, skipPollOnFocusLost } = findLowestPollingInterval(subscriptions);
64-
if (!Number.isFinite(lowestPollingInterval)) return;
63+
const { lowestPollingInterval, skipPollOnFocusLost } =
64+
findLowestPollingInterval(subscriptions)
65+
if (!Number.isFinite(lowestPollingInterval)) return
6566

66-
const currentPoll = currentPolls[queryCacheKey];
67+
const currentPoll = currentPolls[queryCacheKey]
6768

6869
if (currentPoll?.timeout) {
69-
clearTimeout(currentPoll.timeout);
70-
currentPoll.timeout = undefined;
70+
clearTimeout(currentPoll.timeout)
71+
currentPoll.timeout = undefined
7172
}
7273

73-
const nextPollTimestamp = Date.now() + lowestPollingInterval;
74+
const nextPollTimestamp = Date.now() + lowestPollingInterval
7475

75-
// Always update the polling interval
7676
currentPolls[queryCacheKey] = {
7777
nextPollTimestamp,
7878
pollingInterval: lowestPollingInterval,
7979
timeout: setTimeout(() => {
80-
// Conditionally dispatch the query
8180
if (document.hasFocus() || !skipPollOnFocusLost) {
82-
api.dispatch(refetchQuery(querySubState, queryCacheKey));
81+
api.dispatch(refetchQuery(querySubState, queryCacheKey))
8382
}
84-
// Regardless of dispatch, set up the next poll
85-
startNextPoll({ queryCacheKey }, api);
83+
startNextPoll({ queryCacheKey }, api)
8684
}, lowestPollingInterval),
87-
};
85+
}
8886
}
8987

9088
function updatePollingInterval(

0 commit comments

Comments
 (0)