Skip to content

test(react-query/useSuspenseQueries): remove unnecessary 'act' wrapper from background refetch assertions#10350

Merged
sukvvon merged 1 commit intomainfrom
test/react-query-useSuspenseQueries-remove-unnecessary-act
Mar 29, 2026
Merged

test(react-query/useSuspenseQueries): remove unnecessary 'act' wrapper from background refetch assertions#10350
sukvvon merged 1 commit intomainfrom
test/react-query-useSuspenseQueries-remove-unnecessary-act

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Mar 29, 2026

🎯 Changes

Remove unnecessary act wrappers from vi.advanceTimersByTimeAsync calls in background refetch assertions. act is only required when Suspense is involved (suspension/unsuspension), not for background refetches where no React state transition occurs.

✅ 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
    • Refactored test timer handling for background refetch scenarios.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44a1e823-5e42-421e-8943-8cfc620490f8

📥 Commits

Reviewing files that changed from the base of the PR and between 55cee0a and dc1fe0d.

📒 Files selected for processing (1)
  • packages/react-query/src/__tests__/useSuspenseQueries.test.tsx

📝 Walkthrough

Walkthrough

The change removes unnecessary React Testing Library act() wrappers around vi.advanceTimersByTimeAsync() calls in the useSuspenseQueries.test.tsx test file, allowing timer advancements to execute directly while preserving test behavior.

Changes

Cohort / File(s) Summary
Test refactoring
packages/react-query/src/__tests__/useSuspenseQueries.test.tsx
Removed explicit act() wrappers around vi.advanceTimersByTimeAsync() calls in background refetch timing scenarios; timer advances now execute directly without the wrapper.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • TanStack/query#10211: Makes identical test changes to useSuspenseQueries.test.tsx by removing unnecessary act() wrappers around timer advancements.
  • TanStack/query#10212: Removes React Testing Library act() wrappers around timer advancements in suspense-related tests.

Suggested labels

package: react-query

Poem

🐰 No need for act around timers swift,
The tests now flow with cleaner gift,
Async advances, unwrapped and free,
Suspense queries dance with glee!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and specifically describes the main change: removing unnecessary 'act' wrappers from background refetch assertions in useSuspenseQueries tests.
Description check ✅ Passed The pull request description follows the required template with all sections completed: Changes section explains the modification and its technical rationale, Checklist confirms compliance with contributing guidelines and local testing, and Release Impact correctly identifies this as a dev-only change requiring no changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/react-query-useSuspenseQueries-remove-unnecessary-act

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 29, 2026

View your CI Pipeline Execution ↗ for commit dc1fe0d

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

☁️ Nx Cloud last updated this comment at 2026-03-29 06:12:06 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 29, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10350

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10350

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: dc1fe0d

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon merged commit 9e1bb94 into main Mar 29, 2026
10 checks passed
@sukvvon sukvvon deleted the test/react-query-useSuspenseQueries-remove-unnecessary-act branch March 29, 2026 06:12
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