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