Skip to content
Source
Sign inSign up
TanStack/query

docs(angular-query): improve mutationOptions jsdoc code example #9648

Mergedarnoud-dv(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9648/headmerged by arnoud-dv(GitHub profile, opens in a new tab) View on GitHub

Showing 1 changed file with 18 additions and 10 deletions.

x
0 of 1 viewed, 1 left
18 additions and 10 deletionspackages/angular-query-experimental/src/mutation-options.tsModified
View file
@@ -16,17 +16,21 @@
* mutationKey: ["updatePost", id],
* onSuccess: (newPost) => {
* // ^? newPost: Post
- * this.queryClient.setQueryData(["posts", id], newPost);
+ * this.queryClient.setQueryData(["posts", id], newPost)
* },
* });
* }
* }
- * queries = inject(QueriesService)
- * idSignal = new Signal(0);
- * mutation = injectMutation(() => this.queries.updatePost(this.idSignal()))
+ * class ComponentOrService {
+ * queries = inject(QueriesService)
+ * id = signal(0)
+ * mutation = injectMutation(() => this.queries.updatePost(this.id()))
+ * }
- * mutation.mutate({ title: 'New Title' })
+ * save() {
+ * this.mutation.mutate({ title: 'New Title' })
+ * }
* ```
* @param options - The mutation options.