docs(angular-query): improve mutationOptions jsdoc code example #9648
main fromrefs/pull/9648/head·merged by arnoud-dv(GitHub profile, opens in a new tab) View on GitHubClarify that it's inside a class - if AI tooling doesn't understand that it's confusing for humans too.
Summary by CodeRabbit#
- Documentation
- Improved API examples to demonstrate usage within a class context, clarifying how to set up dependencies, define a mutation, and invoke it from an instance (e.g., this.mutation.mutate).
- Examples now better reflect common component/service patterns for easier adoption.
- No functional or API changes; this is a docs-only update aimed at clearer guidance for real-world integration.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: angular-query-experimental
View your CI Pipeline Execution ↗ for commit 4e13e5d8b1d7057cf5c2b94999129beea9470b55
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 1m 47s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 10s View ↗
☁️ Nx Cloud last updated this comment at
2025-09-12 15:09:19UTCMore templates
- @tanstack/query-example-angular-auto-refetching
- @tanstack/query-example-angular-basic
- @tanstack/query-example-angular-basic-persister
- @tanstack/query-example-angular-devtools-panel
- @tanstack/query-example-angular-infinite-query-with-max-pages
- @tanstack/query-example-angular-optimistic-updates
- @tanstack/query-example-angular-pagination
- @tanstack/query-example-angular-query-options-from-a-service
- @tanstack/query-example-angular-router
- @tanstack/query-example-angular-rxjs
- @tanstack/query-example-angular-simple
- @tanstack/query-example-solid-astro
- @tanstack/query-example-solid-basic
- @tanstack/query-example-solid-basic-graphql-request
- @tanstack/query-example-solid-default-query-function
- @tanstack/query-example-solid-simple
- @tanstack/query-example-solid-start-streaming
- @tanstack/query-example-svelte-auto-refetching
- @tanstack/query-example-svelte-basic
- @tanstack/query-example-svelte-load-more-infinite-scroll
- @tanstack/query-example-svelte-optimistic-updates
- @tanstack/query-example-svelte-playground
- @tanstack/query-example-svelte-simple
- @tanstack/query-example-svelte-ssr
- @tanstack/query-example-svelte-star-wars
- @tanstack/query-example-react-algolia
- @tanstack/query-example-react-auto-refetching
- @tanstack/query-example-react-basic
- @tanstack/query-example-react-basic-graphql-request
- @tanstack/query-example-chat
- @tanstack/query-example-react-default-query-function
- @tanstack/query-example-react-devtools-panel
- @tanstack/query-example-eslint-legacy
- @tanstack/query-example-react-infinite-query-with-max-pages
- @tanstack/query-example-react-load-more-infinite-scroll
- @tanstack/query-example-react-nextjs
- @tanstack/query-example-react-nextjs-app-prefetching
- @tanstack/query-example-nextjs-suspense-streaming
- @tanstack/query-example-react-offline
- @tanstack/query-example-react-optimistic-updates-cache
- @tanstack/query-example-react-optimistic-updates-ui
- @tanstack/query-example-react-pagination
- @tanstack/query-example-react-playground
- @tanstack/query-example-react-prefetching
- @tanstack/query-example-react-react-native
- @tanstack/query-example-react-router
- @tanstack/query-example-react-rick-morty
- @tanstack/query-example-react-shadow-dom
- @tanstack/query-example-react-simple
- @tanstack/query-example-react-star-wars
- @tanstack/query-example-react-suspense
- @tanstack/query-example-vue-2.6-basic
- @tanstack/query-example-vue-2.7-basic
- @tanstack/query-example-vue-basic
- @tanstack/query-example-vue-dependent-queries
- @tanstack/query-example-vue-nuxt3
- @tanstack/query-example-vue-persister
- @tanstack/query-example-vue-simple
@tanstack/angular-query-devtools-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@9648@tanstack/angular-query-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-experimental@9648@tanstack/eslint-plugin-query
npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@9648@tanstack/query-async-storage-persister
npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@9648@tanstack/query-broadcast-client-experimental
npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@9648@tanstack/query-core
npm i https://pkg.pr.new/@tanstack/query-core@9648@tanstack/query-devtools
npm i https://pkg.pr.new/@tanstack/query-devtools@9648@tanstack/query-persist-client-core
npm i https://pkg.pr.new/@tanstack/query-persist-client-core@9648@tanstack/query-sync-storage-persister
npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9648@tanstack/react-query
npm i https://pkg.pr.new/@tanstack/react-query@9648@tanstack/react-query-devtools
npm i https://pkg.pr.new/@tanstack/react-query-devtools@9648@tanstack/react-query-next-experimental
npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@9648@tanstack/react-query-persist-client
npm i https://pkg.pr.new/@tanstack/react-query-persist-client@9648@tanstack/solid-query
npm i https://pkg.pr.new/@tanstack/solid-query@9648@tanstack/solid-query-devtools
npm i https://pkg.pr.new/@tanstack/solid-query-devtools@9648@tanstack/solid-query-persist-client
npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@9648@tanstack/svelte-query
npm i https://pkg.pr.new/@tanstack/svelte-query@9648@tanstack/svelte-query-devtools
npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@9648@tanstack/svelte-query-persist-client
npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@9648@tanstack/vue-query
npm i https://pkg.pr.new/@tanstack/vue-query@9648@tanstack/vue-query-devtools
npm i https://pkg.pr.new/@tanstack/vue-query-devtools@9648commit:
4e13e5dCodecov Report#
:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 87.77%. Comparing base (
d179168) to head (4e13e5d). :warning: Report is 2 commits behind head on main.Additional details and impacted files
@@ Coverage Diff @@ ## main #9648 +/- ## =========================================== + Coverage 45.51% 87.77% +42.25% =========================================== Files 209 16 -193 Lines 8379 319 -8060 Branches 1905 75 -1830 =========================================== - Hits 3814 280 -3534 + Misses 4118 34 -4084 + Partials 447 5 -442Components Coverage Δ @tanstack/angular-query-devtools-experimental ∅ <ø> (∅)@tanstack/angular-query-experimental 87.00% <ø> (ø)@tanstack/eslint-plugin-query ∅ <ø> (∅)@tanstack/query-async-storage-persister ∅ <ø> (∅)@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)@tanstack/query-codemods ∅ <ø> (∅)@tanstack/query-core ∅ <ø> (∅)@tanstack/query-devtools ∅ <ø> (∅)@tanstack/query-persist-client-core ∅ <ø> (∅)@tanstack/query-sync-storage-persister ∅ <ø> (∅)@tanstack/query-test-utils ∅ <ø> (∅)@tanstack/react-query ∅ <ø> (∅)@tanstack/react-query-devtools ∅ <ø> (∅)@tanstack/react-query-next-experimental ∅ <ø> (∅)@tanstack/react-query-persist-client ∅ <ø> (∅)@tanstack/solid-query ∅ <ø> (∅)@tanstack/solid-query-devtools ∅ <ø> (∅)@tanstack/solid-query-persist-client ∅ <ø> (∅)@tanstack/svelte-query ∅ <ø> (∅)@tanstack/svelte-query-devtools ∅ <ø> (∅)@tanstack/svelte-query-persist-client ∅ <ø> (∅)@tanstack/vue-query ∅ <ø> (∅)@tanstack/vue-query-devtools ∅ <ø> (∅):rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e3b40d4d0daaf44fadf7aac0a7fa5fea91361442 and bbda462667e3744ff64c1ef5d1a8ac0930deb79e.
📒 Files selected for processing (1)
packages/angular-query-experimental/src/mutation-options.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
packages/angular-query-experimental/src/mutation-options.ts lines 25 to 31OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -22,8 +22,10 @@2222 * }2323 * }2424 *25- * queries = inject(QueriesService)26- * idSignal = new Signal(0);27- * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))25+ * class ComponentOrService {26+ * queries = inject(QueriesService)27+ * idSignal = new Signal(0);28+ * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))29+ * }2830 *29- * mutation.mutate({ title: 'New Title' })31+ * this.mutation.mutate({ title: 'New Title' })⚠️ Potential issue
Fix Angular Signals usage and put mutate call inside the class
- Angular signals are created via
signal(0), notnew Signal(0). - The
this.mutation.mutate(...)call should live inside the class (e.g., a method), not after the class block. - Minor: add missing semicolons for consistency.
- class ComponentOrService { - queries = inject(QueriesService) - idSignal = new Signal(0); - mutation = injectMutation(() => this.queries.updatePost(this.idSignal())) - } - - this.mutation.mutate({ title: 'New Title' }) + class ComponentOrService { + queries = inject(QueriesService); + idSignal = signal(0); + mutation = injectMutation(() => this.queries.updatePost(this.idSignal())); + + save() { + this.mutation.mutate({ title: 'New Title' }); + } + }Note: the snippet assumes
import { inject, signal } from '@angular/core'.📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
class ComponentOrService { queries = inject(QueriesService); idSignal = signal(0); mutation = injectMutation(() => this.queries.updatePost(this.idSignal())); save() { this.mutation.mutate({ title: 'New Title' }); } }🤖 Prompt for AI Agents
In packages/angular-query-experimental/src/mutation-options.ts around lines 25 to 31, replace the incorrect Signal construction and external mutate call: change "new Signal(0)" to "signal(0)" (and ensure "signal" is imported from @angular/core), move the this.mutation.mutate({ ... }) call into a class method (e.g., a public update() or save() method) so it lives inside the class body rather than after the class, and add missing semicolons to the statement endings for consistency.✅ Addressed in commit 4e13e5d
@@ -81,8 +83,10 @@8183 * }8284 * }8385 *84- * queries = inject(QueriesService)85- * idSignal = new Signal(0);86- * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))86+ * class ComponentOrService {87+ * queries = inject(QueriesService)88+ * idSignal = new Signal(0);89+ * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))90+ * }8791 *88- * mutation.mutate({ title: 'New Title' })92+ * this.mutation.mutate({ title: 'New Title' })⚠️ Potential issue
Duplicate snippet: apply the same fixes here
Mirror the same corrections: use
signal(0), keepmutateinside the class (e.g.,save()), and add semicolons.- class ComponentOrService { - queries = inject(QueriesService) - idSignal = new Signal(0); - mutation = injectMutation(() => this.queries.updatePost(this.idSignal())) - } - - this.mutation.mutate({ title: 'New Title' }) + class ComponentOrService { + queries = inject(QueriesService); + idSignal = signal(0); + mutation = injectMutation(() => this.queries.updatePost(this.idSignal())); + + save() { + this.mutation.mutate({ title: 'New Title' }); + } + }Note: the snippet assumes
import { inject, signal } from '@angular/core'.📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
* class ComponentOrService { * queries = inject(QueriesService); * idSignal = signal(0); * mutation = injectMutation(() => this.queries.updatePost(this.idSignal())); * * save() { * this.mutation.mutate({ title: 'New Title' }); * } * }🤖 Prompt for AI Agents
In packages/angular-query-experimental/src/mutation-options.ts around lines 86 to 92, the example uses the old `new Signal(0)` pattern, places `mutate` call outside a class method, and is missing semicolons; change `new Signal(0)` to `signal(0)`, keep the mutate invocation inside the class (e.g., implement a `save()` method that calls `this.mutation.mutate({...});`), add missing semicolons to statements, and ensure the example notes the required import `import { inject, signal } from '@angular/core'`.arnoud-dv(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Warning
Rate limit exceeded#
@arnoud-dv has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 45 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between bbda462667e3744ff64c1ef5d1a8ac0930deb79e and 4e13e5d8b1d7057cf5c2b94999129beea9470b55.
📒 Files selected for processing (1)
packages/angular-query-experimental/src/mutation-options.ts(2 hunks)Walkthrough#
Documentation-only edits in packages/angular-query-experimental/src/mutation-options.ts: JSDoc examples were updated to demonstrate usage within a class context, using injected QueriesService, an idSignal, and injectMutation. No code logic, types, or public APIs changed.
Changes#
packages/angular-query-experimental/src/mutation-options.tsComponentOrService) with injectedQueriesService,idSignal, andinjectMutation; updated invocation frommutation.mutate(...)tothis.mutation.mutate(...). No runtime or type changes.Estimated code review effort#
🎯 1 (Trivial) | ⏱️ ~3 minutes
Suggested labels#
documentationPoem#
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share