Skip to content

test(react-query/QueryResetErrorBoundary): relocate 'issue-9728' test and migrate to fake timers#10090

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/react-query-move-issue-9728-to-query-reset-error-boundary
Open

test(react-query/QueryResetErrorBoundary): relocate 'issue-9728' test and migrate to fake timers#10090
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/react-query-move-issue-9728-to-query-reset-error-boundary

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 3, 2026

🎯 Changes

  • Relocate issue-9728.test.tsx to QueryResetErrorBoundary.test.tsx under the useQuery describe block
  • Migrate from real timers (findByText) to fake timers (advanceTimersByTimeAsync) pattern
  • Remove Suspense wrapper since useQuery (not useSuspenseQuery) does not trigger suspense
  • Wrap with React.StrictMode to match the original test
  • Add useState + useEffect forceUpdate to match the original test
  • Use shared queryClient from the describe block instead of creating a local one
  • Move retry and staleTime from defaultOptions to inline useQuery options
  • Delete standalone issue-9728.test.tsx file

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Reorganized test scenarios for error boundary and refetch handling with infinite staleTime configurations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

A test file covering issue #9728 (refetch behavior after errors with infinite staleTime) is being removed, and its test scenario is being consolidated into the QueryResetErrorBoundary test file, with the test scenario added to verify error recovery and refetch behavior.

Changes

Cohort / File(s) Summary
Test Consolidation
packages/react-query/src/__tests__/QueryResetErrorBoundary.test.tsx
Adds a new test scenario verifying refetch after error when staleTime is Infinity and initial data exists, including error boundary reset and subsequent successful fetch with updated data.
Test File Removal
packages/react-query/src/__tests__/issue-9728.test.tsx
Removes standalone test file for issue #9728 that exercised the same error boundary and refetch scenario.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • TkDodo
  • manudeli

Poem

🐰 Tests were scattered, now they're home,
In one file's warmth, no more to roam,
Where boundaries catch errors with grace,
And queries refetch in their rightful place! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: relocating a test file and migrating to fake timers, which aligns with the actual file modifications.
Description check ✅ Passed The description follows the template with completed sections, detailed change list, all checklist items addressed, and release impact correctly marked as dev-only.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2026

⚠️ No Changeset found

Latest commit: 394b003

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Feb 3, 2026

View your CI Pipeline Execution ↗ for commit 394b003

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 9s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-03 15:15:18 UTC

@sukvvon sukvvon force-pushed the test/react-query-move-issue-9728-to-query-reset-error-boundary branch from 0c1a60e to 8611975 Compare February 3, 2026 15:03
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 3, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10090

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10090

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10090

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10090

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10090

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10090

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10090

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10090

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10090

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10090

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10090

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10090

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10090

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10090

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10090

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10090

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10090

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10090

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10090

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10090

commit: 394b003

@sukvvon sukvvon force-pushed the test/react-query-move-issue-9728-to-query-reset-error-boundary branch from 8611975 to 8e53007 Compare February 3, 2026 15:07
@sukvvon sukvvon force-pushed the test/react-query-move-issue-9728-to-query-reset-error-boundary branch from 8e53007 to 394b003 Compare February 3, 2026 15:10
@sukvvon sukvvon marked this pull request as ready for review February 3, 2026 15:10
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