Uh oh!
There was an error while loading. Please reload this page.
test({react,preact}-query): use the '.then()' convention consistently - #11085
Conversation
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
View your CI Pipeline Execution ↗ for commit 79c2287
☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughTest-only refactors replace ChangesPromise-chain test fixture refactor
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🎯 Changes
Several
queryFn/mutationFnimplementations were left asasync/awaiteven though the surrounding tests in each file overwhelmingly use the.then()convention. This PR converts the remaining cases where a side effect (counter increment,.push(), throw) happens strictly afterawait sleep(...), so it can be expressed assleep(...).then(() => { ... })without changing execution order.Cases where a side effect happens before
sleep(...)are intentionally left asasync/await, since converting them would require pulling the side effect out of the.then()callback and wouldn't shorten or clarify the code.useInfiniteQuery: converted 2queryFns in bothreact-queryandpreact-queryuseMutation: converted severalmutationFns (removed unnecessaryasyncon already-.then()-based functions, converted sleep-then-effect cases) in both packagesuseQueries: convertedqueryFns with post-sleep side effects, removed unnecessaryasyncon functions with noawaituseQuery(+useQuery.promise,useSuspenseQueryinreact-query): convertedqueryFns with post-sleep side effects/throws✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit