Skip to content

Commit

Permalink
Switch default invalidation behavior to "delayed"
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Oct 28, 2023
1 parent 8b2ccbb commit 712f90e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/toolkit/src/query/core/buildSlice.ts
Expand Up @@ -28,6 +28,7 @@ import { calculateProvidedByThunk } from './buildThunks'
import type {
AssertTagTypes,
EndpointDefinitions,
FullTagDescription,
QueryDefinition,
} from '../endpointDefinitions'
import type { Patch } from 'immer'
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/createApi.ts
Expand Up @@ -265,7 +265,7 @@ export function buildCreateApi<Modules extends [Module<any>, ...Module<any>[]]>(
refetchOnMountOrArgChange: false,
refetchOnFocus: false,
refetchOnReconnect: false,
invalidationBehavior: 'immediately',
invalidationBehavior: 'delayed',
...options,
extractRehydrationInfo,
serializeQueryArgs(queryArgsApi) {
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/buildSlice.test.ts
Expand Up @@ -51,7 +51,7 @@ describe('buildSlice', () => {
api: {
config: {
focused: true,
invalidationBehavior: "immediately",
invalidationBehavior: 'delayed',
keepUnusedDataFor: 60,
middlewareRegistered: true,
online: true,
Expand Down
1 change: 1 addition & 0 deletions packages/toolkit/src/tests/combineSlices.test.ts
Expand Up @@ -33,6 +33,7 @@ const api = {
subscriptions: {},
config: {
reducerPath: 'api',
invalidationBehavior: 'delayed',
online: false,
focused: false,
keepUnusedDataFor: 60,
Expand Down

0 comments on commit 712f90e

Please sign in to comment.