Skip to content

Commit 21d642f

Browse files
committed
Force selector type for infinite query test
1 parent 758c132 commit 21d642f

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

packages/toolkit/src/query/core/apiState.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,11 @@ export type QuerySubState<D extends BaseEndpointDefinition<any, any, any>> = Id<
226226
>
227227

228228
export type InfiniteQuerySubState<D extends BaseEndpointDefinition<any, any, any>> = QuerySubState<D> & {
229-
hasNextPage: boolean
230-
hasPreviousPage: boolean
231-
isFetchingNextPage: boolean
232-
isFetchingPreviousPage: boolean
229+
// TODO: These shouldn't be optional
230+
hasNextPage?: boolean
231+
hasPreviousPage?: boolean
232+
isFetchingNextPage?: boolean
233+
isFetchingPreviousPage?: boolean
233234
param?: QueryArgFrom<D>
234235
direction?: 'forward' | 'backwards'
235236
}

packages/toolkit/src/query/core/buildInitiate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ export function buildInitiate({
284284
})
285285
return runningQueries.get(dispatch)?.[queryCacheKey] as
286286
| QueryActionCreatorResult<never>
287+
| InfiniteQueryActionCreatorResult<never>
287288
| undefined
288289
}
289290
}

packages/toolkit/src/query/core/buildSelectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function buildSelectors<
230230
queryArgs === skipToken ? selectSkippedQuery : selectQuerySubstate
231231

232232
return createSelector(finalSelectQuerySubState, withRequestFlags)
233-
}) as QueryResultSelectorFactory<any, RootState>
233+
}) as InfiniteQueryResultSelectorFactory<any, RootState>
234234
}
235235

236236
function buildMutationSelector() {

packages/toolkit/src/query/core/module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { buildSelectors } from './buildSelectors'
3939
import type {
4040
MutationActionCreatorResult,
4141
QueryActionCreatorResult,
42+
InfiniteQueryActionCreatorResult
4243
} from './buildInitiate'
4344
import { buildInitiate } from './buildInitiate'
4445
import { assertCast, safeAssign } from '../tsHelpers'
@@ -159,6 +160,7 @@ declare module '../apiTypes' {
159160
| QueryActionCreatorResult<
160161
Definitions[EndpointName] & { type: 'query' }
161162
>
163+
| InfiniteQueryActionCreatorResult<Definitions[EndpointName] & {type: 'infinitequery'}>
162164
| undefined
163165
>
164166

@@ -191,7 +193,7 @@ declare module '../apiTypes' {
191193
* See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for details.
192194
*/
193195
getRunningQueriesThunk(): ThunkWithReturnValue<
194-
Array<QueryActionCreatorResult<any>>
196+
Array<QueryActionCreatorResult<any> | InfiniteQueryActionCreatorResult<any>>
195197
>
196198

197199
/**
@@ -561,6 +563,7 @@ export const coreModule = ({
561563
context,
562564
queryThunk,
563565
mutationThunk,
566+
infiniteQueryThunk,
564567
api,
565568
assertTagType,
566569
})

0 commit comments

Comments
 (0)