fix(react-query): add missing subscribed option to UseInfiniteQueryOp… #8546
+7
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds the missing
subscribed
option to theUseInfiniteQueryOptions
type, as discussed in #8538.Context
Both
useQuery
anduseInfiniteQuery
rely onuseBaseQuery
under the hood, and the subscription logic resides inuseBaseQuery
. However, the options type foruseInfiniteQuery
does not currently extendUseBaseQueryOptions
, which would seem logical given their shared base.Approach
Initially, I attempted to make
UseInfiniteQueryOptions
extendUseBaseQueryOptions
. To achieve this, I broadenedUseBaseQueryOptions
to accept an additional generic parameter,TPageParam
, required for infinite queries. However, this caused a lot of type breaks throughout the codebase, asUseBaseQueryOptions
appears to have been designed specifically foruseQuery
.To avoid widespread changes and potential compatibility issues, I decided to stick with the existing approach. Instead, I directly added the
subscribed
field toUseInfiniteQueryOptions
. This resolves the issue for now without disrupting other parts of the type system.