@@ -28,8 +28,8 @@ import { calculateProvidedByThunk } from './buildThunks'
2828import type {
2929 AssertTagTypes ,
3030 EndpointDefinitions ,
31- FullTagDescription ,
32- QueryDefinition ,
31+ FullTagDescription , InfiniteQueryDefinition ,
32+ QueryDefinition
3333} from '../endpointDefinitions'
3434import type { Patch } from 'immer'
3535import { isDraft } from 'immer'
@@ -426,32 +426,71 @@ export function buildSlice({
426426 name : `${ reducerPath } /infinitequeries` ,
427427 initialState : initialState as QueryState < any > ,
428428 reducers : {
429- changeDirection : {
430- reducer (
431- draft ,
432- { payload : { queryCacheKey } } : PayloadAction < QuerySubstateIdentifier >
433- ) {
434- } ,
435- prepare : prepareAutoBatched < QuerySubstateIdentifier > ( ) ,
436- } ,
437- combineArgsFromSelection : {
438- reducer (
439- draft ,
429+ fetchNextPage (
430+ d ,
431+ a : PayloadAction <
440432 {
441- payload : { queryCacheKey, patches } ,
442- } : PayloadAction <
443- QuerySubstateIdentifier & { patches : readonly Patch [ ] }
444- >
445- ) {
446- updateQuerySubstateIfExists ( draft , queryCacheKey , ( substate ) => {
447- substate . originalArgs = substate
448- } )
449- } ,
450- prepare : prepareAutoBatched <
451- QuerySubstateIdentifier & { patches : readonly Patch [ ] }
452- > ( ) ,
433+ endpointName : string
434+ requestId : string
435+ options : Subscribers [ number ]
436+ } & QuerySubstateIdentifier
437+ > ,
438+ ) {
439+ // Dummy
453440 } ,
441+ unsubscribeQueryResult (
442+ d ,
443+ a : PayloadAction < { requestId : string } & QuerySubstateIdentifier > ,
444+ ) {
445+ // Dummy
446+ } ,
447+ internal_getRTKQSubscriptions ( ) { } ,
454448 } ,
449+ // extraReducers(builder) {
450+ // builder
451+ // .addCase(queryThunk.fulfilled, (draft, { meta, payload }) => {
452+ // updateQuerySubstateIfExists(
453+ // draft,
454+ // meta.arg.queryCacheKey,
455+ // (substate) => {
456+ // const { infiniteQueryOptions } = definitions[
457+ // meta.arg.endpointName
458+ // ] as InfiniteQueryDefinition<any, any, any, any>
459+ // substate.status = QueryStatus.fulfilled
460+ // if(!infiniteQueryOptions) return
461+ //
462+ // if (substate.data !== undefined) {
463+ // const { fulfilledTimeStamp, arg, baseQueryMeta, requestId } =
464+ // meta
465+ // // There's existing cache data. Let the user merge it in themselves.
466+ // // We're already inside an Immer-powered reducer, and the user could just mutate `substate.data`
467+ // // themselves inside of `merge()`. But, they might also want to return a new value.
468+ // // Try to let Immer figure that part out, save the result, and assign it to `substate.data`.
469+ // substate.data = payload
470+ // } else {
471+ // // Presumably a fresh request. Just cache the response data.
472+ // substate.data = payload
473+ // }
474+ // } else {
475+ // // Assign or safely update the cache data.
476+ // substate.data =
477+ // definitions[meta.arg.endpointName].structuralSharing ?? true
478+ // ? copyWithStructuralSharing(
479+ // isDraft(substate.data)
480+ // ? original(substate.data)
481+ // : substate.data,
482+ // payload,
483+ // )
484+ // : payload
485+ // }
486+ //
487+ // delete substate.error
488+ // substate.fulfilledTimeStamp = meta.fulfilledTimeStamp
489+ // },
490+ // )
491+ // })
492+
493+ // },
455494 } )
456495
457496
0 commit comments