@@ -126,17 +126,22 @@ export function buildSlice({
126
126
} ,
127
127
prepare : prepareAutoBatched < QuerySubstateIdentifier > ( ) ,
128
128
} ,
129
- queryResultPatched (
130
- draft ,
131
- {
132
- payload : { queryCacheKey, patches } ,
133
- } : PayloadAction <
129
+ queryResultPatched : {
130
+ reducer (
131
+ draft ,
132
+ {
133
+ payload : { queryCacheKey, patches } ,
134
+ } : PayloadAction <
135
+ QuerySubstateIdentifier & { patches : readonly Patch [ ] }
136
+ >
137
+ ) {
138
+ updateQuerySubstateIfExists ( draft , queryCacheKey , ( substate ) => {
139
+ substate . data = applyPatches ( substate . data as any , patches . concat ( ) )
140
+ } )
141
+ } ,
142
+ prepare : prepareAutoBatched <
134
143
QuerySubstateIdentifier & { patches : readonly Patch [ ] }
135
- >
136
- ) {
137
- updateQuerySubstateIfExists ( draft , queryCacheKey , ( substate ) => {
138
- substate . data = applyPatches ( substate . data as any , patches . concat ( ) )
139
- } )
144
+ > ( ) ,
140
145
} ,
141
146
} ,
142
147
extraReducers ( builder ) {
@@ -327,33 +332,39 @@ export function buildSlice({
327
332
name : `${ reducerPath } /invalidation` ,
328
333
initialState : initialState as InvalidationState < string > ,
329
334
reducers : {
330
- updateProvidedBy : (
331
- draft ,
332
- action : PayloadAction < {
333
- queryCacheKey : QueryCacheKey
334
- providedTags : readonly FullTagDescription < string > [ ]
335
- } >
336
- ) => {
337
- const { queryCacheKey, providedTags } = action . payload
335
+ updateProvidedBy : {
336
+ reducer (
337
+ draft ,
338
+ action : PayloadAction < {
339
+ queryCacheKey : QueryCacheKey
340
+ providedTags : readonly FullTagDescription < string > [ ]
341
+ } >
342
+ ) {
343
+ const { queryCacheKey, providedTags } = action . payload
338
344
339
- for ( const tagTypeSubscriptions of Object . values ( draft ) ) {
340
- for ( const idSubscriptions of Object . values ( tagTypeSubscriptions ) ) {
341
- const foundAt = idSubscriptions . indexOf ( queryCacheKey )
342
- if ( foundAt !== - 1 ) {
343
- idSubscriptions . splice ( foundAt , 1 )
345
+ for ( const tagTypeSubscriptions of Object . values ( draft ) ) {
346
+ for ( const idSubscriptions of Object . values ( tagTypeSubscriptions ) ) {
347
+ const foundAt = idSubscriptions . indexOf ( queryCacheKey )
348
+ if ( foundAt !== - 1 ) {
349
+ idSubscriptions . splice ( foundAt , 1 )
350
+ }
344
351
}
345
352
}
346
- }
347
353
348
- for ( const { type, id } of providedTags ) {
349
- const subscribedQueries = ( ( draft [ type ] ??= { } ) [
350
- id || '__internal_without_id'
351
- ] ??= [ ] )
352
- const alreadySubscribed = subscribedQueries . includes ( queryCacheKey )
353
- if ( ! alreadySubscribed ) {
354
- subscribedQueries . push ( queryCacheKey )
354
+ for ( const { type, id } of providedTags ) {
355
+ const subscribedQueries = ( ( draft [ type ] ??= { } ) [
356
+ id || '__internal_without_id'
357
+ ] ??= [ ] )
358
+ const alreadySubscribed = subscribedQueries . includes ( queryCacheKey )
359
+ if ( ! alreadySubscribed ) {
360
+ subscribedQueries . push ( queryCacheKey )
361
+ }
355
362
}
356
- }
363
+ } ,
364
+ prepare : prepareAutoBatched < {
365
+ queryCacheKey : QueryCacheKey
366
+ providedTags : readonly FullTagDescription < string > [ ]
367
+ } > ( ) ,
357
368
} ,
358
369
} ,
359
370
extraReducers ( builder ) {
0 commit comments