Conversation
…or getter overloads
📝 WalkthroughWalkthroughFour new Vitest test cases were added to validate Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit f4ff840
☁️ 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 📦
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/vue-query/src/__tests__/mutationOptions.test.ts (1)
353-480: Consider extracting a small helper for the repeated subscribe/assert flow.These four tests duplicate the same setup and assertion pattern; a helper would reduce maintenance cost and keep future additions tighter.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/vue-query/src/__tests__/mutationOptions.test.ts` around lines 353 - 480, The four tests duplicate subscribing to the mutation cache and asserting isMutating changes; extract a small helper (e.g., runMutatingSubscribeTest) that accepts parameters like an array of mutationOptions factories (mutationOptions), an optional filter/options object (for mutationKey), and expected max value, then encapsulate the common flow: create queryClient via useQueryClient, resolve any provided mutationOptions (resolvedOpts), call useMutation for each option to get mutate functions, subscribe to queryClient.getMutationCache().subscribe to push queryClient.isMutating(filter?) into a local array, invoke the mutate functions, advance timers (vi.advanceTimersByTimeAsync), assert Math.max(...array) and final array tail equals 0, and unsubscribe; replace the four duplicated test bodies to call this helper with appropriate arguments (single getter with/without mutationKey, two concurrent mutations, and filtered mutationKey case).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/vue-query/src/__tests__/mutationOptions.test.ts`:
- Around line 353-480: The four tests duplicate subscribing to the mutation
cache and asserting isMutating changes; extract a small helper (e.g.,
runMutatingSubscribeTest) that accepts parameters like an array of
mutationOptions factories (mutationOptions), an optional filter/options object
(for mutationKey), and expected max value, then encapsulate the common flow:
create queryClient via useQueryClient, resolve any provided mutationOptions
(resolvedOpts), call useMutation for each option to get mutate functions,
subscribe to queryClient.getMutationCache().subscribe to push
queryClient.isMutating(filter?) into a local array, invoke the mutate functions,
advance timers (vi.advanceTimersByTimeAsync), assert Math.max(...array) and
final array tail equals 0, and unsubscribe; replace the four duplicated test
bodies to call this helper with appropriate arguments (single getter
with/without mutationKey, two concurrent mutations, and filtered mutationKey
case).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8cefcf08-c635-44e6-8eca-1846f371ed4c
📒 Files selected for processing (1)
packages/vue-query/src/__tests__/mutationOptions.test.ts
🎯 Changes
mutationOptionsgetter overloads withqueryClient.isMutating:should return the number of fetching mutations when used with queryClient.isMutating (getter with mutationKey in mutationOptions)should return the number of fetching mutations when used with queryClient.isMutating (getter without mutationKey in mutationOptions)should return the number of fetching mutations when used with queryClient.isMutating (getter): multiple mutations with gettershould return the number of fetching mutations when used with queryClient.isMutating (getter, filter mutationOpts1.mutationKey): filter bymutationKeywith getter✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit