Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-query): add missing subscribed option to UseInfiniteQueryOp… #8546

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SMhdAsadi
Copy link

This pull request adds the missing subscribed option to the UseInfiniteQueryOptions type, as discussed in #8538.

Context

Both useQuery and useInfiniteQuery rely on useBaseQuery under the hood, and the subscription logic resides in useBaseQuery. However, the options type for useInfiniteQuery does not currently extend UseBaseQueryOptions, which would seem logical given their shared base.

Approach

Initially, I attempted to make UseInfiniteQueryOptions extend UseBaseQueryOptions. To achieve this, I broadened UseBaseQueryOptions to accept an additional generic parameter, TPageParam, required for infinite queries. However, this caused a lot of type breaks throughout the codebase, as UseBaseQueryOptions appears to have been designed specifically for useQuery.

To avoid widespread changes and potential compatibility issues, I decided to stick with the existing approach. Instead, I directly added the subscribed field to UseInfiniteQueryOptions. This resolves the issue for now without disrupting other parts of the type system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant