snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
25
docs/framework/vue/guides/query-cancellation.md
Normal file
25
docs/framework/vue/guides/query-cancellation.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
id: query-cancellation
|
||||
title: Query Cancellation
|
||||
ref: docs/framework/react/guides/query-cancellation.md
|
||||
---
|
||||
|
||||
[//]: # 'Example7'
|
||||
|
||||
```ts
|
||||
const query = useQuery({
|
||||
queryKey: ['todos'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const resp = await fetch('/todos', { signal })
|
||||
return resp.json()
|
||||
},
|
||||
})
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
function onButtonClick() {
|
||||
queryClient.cancelQueries({ queryKey: ['todos'] })
|
||||
}
|
||||
```
|
||||
|
||||
[//]: # 'Example7'
|
||||
Reference in New Issue
Block a user