test(react-query/useQuery.promise): unskip 'cancelQueries' while suspending test by keeping 'queryFn' in-flight - #10910
Conversation
…ending test by keeping 'queryFn' in-flight
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA previously skipped suspension and cancellation test is enabled. Its mocked query function now waits longer before resolving with constant data, preserving the in-flight promise while ChangesTest cancellation behavior under suspension
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 26df022
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
…n cancel-while-suspending test
🎯 Changes
Unskip
should stay pending when canceled with cancelQueries while suspending until refetched.The test was skipped because it had become flaky. With
vi.useFakeTimers({ shouldAdvanceTime: true }), awaitingtakeRender()advances the shared fake clock by ~35ms while waiting for the React commit. The originalsleep(10)queryFntherefore resolved beforecancelwas clicked, so the query reachedsuccessinstead of staying in-flight — the "cancel while suspending" scenario could never be exercised.sleepfrom10to50so the fetch outlasts thetakeRenderclock advance and is still in-flight whencancelQueriesruns.queryFnto thesleep(...).then(...)form and drop the unusedcountcounter (its return value is never asserted; the test verifies state and asetQueryDatavalue).sleepis intentionally longer than usual.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Note: This release contains no user-facing changes or new features.