Open History to see the last commit
1---
2id: useIsMutating
3title: useIsMutating
4redirect_from:
5 - framework/vue/reference/useIsMutating
6---
7β
8```ts
9function useIsMutating(filters?: UseIsMutatingFilters, queryClient?: QueryClient): Ref<number>;
10```
11β
12Defined in: [packages/vue-query/src/useMutationState.ts:55](https://github.com/TanStack/query/blob/main/packages/vue-query/src/useMutationState.ts#L55)
13β
14The `useIsMutating` composable returns a `ref` to the `number` of mutations that your application currently
15has `pending` (useful for app-wide loading indicators).
16β
17`filters` may be a plain object, `MaybeRefDeep`, or a reactive getter (`() => ({ ... })`) β pass a getter if
18the filters themselves depend on other reactive state.
19β
20## Parameters
21β
22### filters?
23β
24[`UseIsMutatingFilters`](../type-aliases/UseIsMutatingFilters.md) = `{}`
25β
26The [MutationFilters](../interfaces/MutationFilters.md) to narrow down the matched mutations.
27β
28### queryClient?
29β
30[`QueryClient`](../classes/QueryClient.md)
31β
32Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`
33will be used.
34β
35## Returns
36β
37`Ref`\<`number`\>
38β
39A `ref` to the `number` of the mutations that your application currently has `pending`.
40β
41## Example
42β
43```vue
44<script setup lang="ts">
45import { useIsMutating } from '@tanstack/vue-query'
46β
47// How many mutations matching the posts prefix are in progress?
48const isMutatingPosts = useIsMutating({ mutationKey: ['posts'] })
49</script>
50β
51<template>
52 <span v-if="isMutatingPosts">Saving posts...</span>
53</template>
54```