test(react-query/useQuery.promise): unskip 'cancelQueries' while suspending test by keeping 'queryFn' in-flight#10910
Conversation
…ending test by keeping 'queryFn' in-flight
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughA previously skipped test in the ChangesTest cancellation behavior under suspension
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 9f788de
☁️ 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.