test({react,preact}-query): use the '.then()' convention consistently#11085
Merged
Conversation
…tion consistently
Contributor
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
Contributor
size-limit report 📦
|
|
View your CI Pipeline Execution ↗ for commit 79c2287
☁️ Nx Cloud last updated this comment at |
Contributor
📝 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 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