Skip to content

Commit 08ee2be

Browse files
authored
doc: add computed tip for vue query (#446)
* doc: add computed tip for vue query * fix typo
1 parent 6ad87cb commit 08ee2be

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/reference/plugins/tanstack-query.mdx

+12
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,18 @@ const onCreate = () => {
422422
</div>
423423
</template>
424424
```
425+
:::tip
426+
If the query parameters are not constant, you need to wrap the query in a `computed` to make it reactive.
427+
```ts
428+
const queryParams = computed(() => ({
429+
where: {
430+
space: { slug: route.params.slug as string },
431+
id: meQuery.data.value?.userId
432+
},
433+
}));
434+
const { data: posts } = useFindManyPost(queryParams);
435+
```
436+
:::
425437
426438
</TabItem>
427439

0 commit comments

Comments
 (0)