Skip to content

feat(react-query): backport v5 apis about infinite query #9334

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

Draft
wants to merge 4 commits into
base: v4
Choose a base branch
from

Conversation

manudeli
Copy link
Collaborator

@manudeli manudeli commented Jun 29, 2025

New Features and Utilities:

  • Added infiniteQueryOptions
  • Added useSuspenseInfiniteQuery

Deprecations:

  • Marked several overloads of useQuery and useInfiniteQuery as deprecated, with a note that they will be removed in the next major version. (packages/react-query/src/useQuery.ts, packages/react-query/src/useInfiniteQuery.ts)

Package and Export Updates:

  • Exported useSuspenseInfiniteQuery, infiniteQueryOptions, and related types from the main package index.

@manudeli manudeli self-assigned this Jun 29, 2025
Copy link

nx-cloud bot commented Jun 29, 2025

View your CI Pipeline Execution ↗ for commit 91170ba

Command Status Duration Result
nx affected --targets=test:lib,test:types,test:... ⏳ In Progress ... View ↗
nx affected --targets=test:lib --base=7e5e9f5f0... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-16 11:33:17 UTC

@manudeli manudeli force-pushed the react-query/backport-infinite-query branch from 5b39d68 to 8e281a9 Compare July 16, 2025 06:06
…s for useSuspenseInfiniteQuery

- Refactored infinite query tests to use a unified options function.
- Added type checks for the new `useSuspenseInfiniteQuery` hook.
- Improved test structure for better readability and maintainability.
@manudeli manudeli requested a review from Copilot July 16, 2025 09:14
Copilot

This comment was marked as outdated.

…in useInfiniteQuery and useSuspenseInfiniteQuery

- Standardized spacing in deprecated JSDoc comments for clarity.
- Reorganized type imports in useSuspenseInfiniteQuery for better readability.
@manudeli manudeli requested a review from Copilot July 16, 2025 09:25
Copilot

This comment was marked as outdated.

…nts across query methods

- Unified formatting of deprecated JSDoc comments in QueryCache, QueryClient, and types to enhance clarity.
- Updated comments to reflect upcoming changes in method signatures and usage.
@manudeli manudeli requested a review from Copilot July 16, 2025 09:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR backports v5 infinite query APIs into the v4 codebase, introducing new utilities and marking older overloads as deprecated.

  • Added a new useSuspenseInfiniteQuery hook with built-in suspense and error boundary support
  • Introduced the infiniteQueryOptions helper for building infinite query option objects
  • Updated deprecation messages on various useQuery and useInfiniteQuery overloads and consolidated exports

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react-query/src/useSuspenseInfiniteQuery.ts Added useSuspenseInfiniteQuery hook
packages/react-query/src/useQuery.ts Expanded deprecation messages on useQuery overloads
packages/react-query/src/useInfiniteQuery.ts Expanded deprecation messages on useInfiniteQuery overloads
packages/react-query/src/queryOptions.ts Wrapped UndefinedInitialDataOptions in WithRequired
packages/react-query/src/infiniteQueryOptions.ts Created infiniteQueryOptions utility
packages/react-query/src/index.ts Exported new hook and options utility
packages/react-query/src/tests/useSuspenseInfiniteQuery.types.test.tsx Added type tests for useSuspenseInfiniteQuery
packages/react-query/src/tests/queryOptions.types.test.tsx Updated queryOptions tests with useQuery
packages/react-query/src/tests/infiniteQueryOptions.types.test.tsx Added type tests for infiniteQueryOptions
packages/react-query/src/tests/infiniteQueryOptions.test.tsx Added runtime test for infiniteQueryOptions
packages/query-core/src/types.ts Consolidated deprecated comments into single lines
packages/query-core/src/queryClient.ts Consolidated deprecated comments into single lines
packages/query-core/src/queryCache.ts Consolidated deprecated comments into single lines
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/react-query/src/useSuspenseInfiniteQuery.ts:44

  • [nitpick] Consider adding a JSDoc comment above useSuspenseInfiniteQuery to explain its purpose, parameters, and return type for better discoverability and maintainability.
export function useSuspenseInfiniteQuery<

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

Successfully merging this pull request may close these issues.

1 participant