@tanstack/vue-query 4.10.3 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/build/lib/useIsFetching.esm.js +1 -0
- package/build/lib/useIsFetching.esm.js.map +1 -1
- package/build/lib/useIsFetching.js +1 -0
- package/build/lib/useIsFetching.js.map +1 -1
- package/build/lib/useIsFetching.mjs +1 -0
- package/build/lib/useIsFetching.mjs.map +1 -1
- package/build/lib/useIsMutating.esm.js +1 -0
- package/build/lib/useIsMutating.esm.js.map +1 -1
- package/build/lib/useIsMutating.js +1 -0
- package/build/lib/useIsMutating.js.map +1 -1
- package/build/lib/useIsMutating.mjs +1 -0
- package/build/lib/useIsMutating.mjs.map +1 -1
- package/build/umd/index.development.js +29 -10
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.esm.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,GAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,KAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAA/B,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,UAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,QAAQ,EAAElB,IAAAA;KAA/B,CAAA;AACD,GAFD,MAEO;
|
|
1
|
+
{"version":3,"file":"useIsFetching.esm.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,GAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,KAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAA/B,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,UAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,QAAQ,EAAElB,IAAAA;KAA/B,CAAA;AACD,GAFD,MAEO;AACL;IACAgB,OAAO,GAAGhB,IAAI,IAAI,EAAlB,CAAA;AACD,GAAA;;EAED,OAAOmB,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;;;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,WAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,6BAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,WAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,aAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAA/B,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,sBAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,gBAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,QAAQ,EAAElB,IAAAA;KAA/B,CAAA;AACD,GAFD,MAEO;
|
|
1
|
+
{"version":3,"file":"useIsFetching.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;;;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,WAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,6BAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,WAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,aAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAA/B,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,sBAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,gBAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,QAAQ,EAAElB,IAAAA;KAA/B,CAAA;AACD,GAFD,MAEO;AACL;IACAgB,OAAO,GAAGhB,IAAI,IAAI,EAAlB,CAAA;AACD,GAAA;;EAED,OAAOmB,oBAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsFetching.mjs","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,GAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,KAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAA/B,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,UAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,QAAQ,EAAElB,IAAAA;KAA/B,CAAA;AACD,GAFD,MAEO;
|
|
1
|
+
{"version":3,"file":"useIsFetching.mjs","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { QueryKey, QueryFilters as QF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: QueryKey,\n filters?: QueryFilters,\n): Ref<number>\nexport function useIsFetching(\n arg1?: QueryKey | QueryFilters,\n arg2?: QueryFilters,\n): Ref<number> {\n const filters = ref(parseFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isFetching = ref(queryClient.isFetching(filters))\n\n const unsubscribe = queryClient.getQueryCache().subscribe(() => {\n isFetching.value = queryClient.isFetching(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseFilterArgs(arg1, arg2)\n isFetching.value = queryClient.isFetching(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isFetching\n}\n\nexport function parseFilterArgs(\n arg1?: QueryKey | QueryFilters,\n arg2: QueryFilters = {},\n) {\n let options: QueryFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, queryKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","ref","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAhB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,C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opeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,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useIsMutating.esm.js","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aA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AAAWiB,MAAAA,WAAW,EAAElB,IAAAA;KAAlC,CAAA;AACD,GAFD,MAEO;AACL;IACAgB,OAAO,GAAGhB,IAAI,IAAI,EAAlB,CAAA;AACD,GAAA;;EAED,OAAOmB,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMutating.js","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;;;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,WAAG,CAACC,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAxB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,6BAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,WAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,gBAAZ,EAA+BC,CAAAA,SAA/B,CAAyC,MAAM;IACjEH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,aAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAvC,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,sBAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,uBAAT,CACLJ,IADK,EAELC,IAAqB,GAAG,EAFnB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,gBAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,WAAW,EAAElB,IAAAA;KAAlC,CAAA;AACD,GAFD,MAEO;
|
|
1
|
+
{"version":3,"file":"useIsMutating.js","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;;;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,WAAG,CAACC,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAxB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,6BAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,WAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,gBAAZ,EAA+BC,CAAAA,SAA/B,CAAyC,MAAM;IACjEH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,aAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAvC,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,sBAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,uBAAT,CACLJ,IADK,EAELC,IAAqB,GAAG,EAFnB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,gBAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,WAAW,EAAElB,IAAAA;KAAlC,CAAA;AACD,GAFD,MAEO;AACL;IACAgB,OAAO,GAAGhB,IAAI,IAAI,EAAlB,CAAA;AACD,GAAA;;EAED,OAAOmB,oBAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMutating.mjs","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAxB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,GAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,gBAAZ,EAA+BC,CAAAA,SAA/B,CAAyC,MAAM;IACjEH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,KAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAvC,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,uBAAT,CACLJ,IADK,EAELC,IAAqB,GAAG,EAFnB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,UAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,WAAW,EAAElB,IAAAA;KAAlC,CAAA;AACD,GAFD,MAEO;
|
|
1
|
+
{"version":3,"file":"useIsMutating.mjs","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { onScopeDispose, ref, watch } from 'vue-demi'\nimport type { Ref } from 'vue-demi'\nimport type { MutationKey, MutationFilters as MF } from '@tanstack/query-core'\n\nimport { useQueryClient } from './useQueryClient'\nimport { cloneDeepUnref, isQueryKey } from './utils'\nimport type { MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MutationKey,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MutationKey | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = ref(parseMutationFilterArgs(arg1, arg2))\n const queryClient =\n filters.value.queryClient ?? useQueryClient(filters.value.queryClientKey)\n\n const isMutating = ref(queryClient.isMutating(filters))\n\n const unsubscribe = queryClient.getMutationCache().subscribe(() => {\n isMutating.value = queryClient.isMutating(filters)\n })\n\n watch(\n [() => arg1, () => arg2],\n () => {\n filters.value = parseMutationFilterArgs(arg1, arg2)\n isMutating.value = queryClient.isMutating(filters)\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe()\n })\n\n return isMutating\n}\n\nexport function parseMutationFilterArgs(\n arg1?: MutationKey | MutationFilters,\n arg2: MutationFilters = {},\n) {\n let options: MutationFilters\n\n if (isQueryKey(arg1)) {\n options = { ...arg2, mutationKey: arg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = arg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","ref","parseMutationFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,GAAG,CAACC,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAxB,CAAnB,CAAA;AACA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA,GACfH,OAAO,CAACI,KAAR,CAAcD,WADC,KACcE,IAAAA,GAAAA,qBAAAA,GAAAA,cAAc,CAACL,OAAO,CAACI,KAAR,CAAcE,cAAf,CAD7C,CAAA;EAGA,MAAMC,UAAU,GAAGN,GAAG,CAACE,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMQ,WAAW,GAAGL,WAAW,CAACM,gBAAZ,EAA+BC,CAAAA,SAA/B,CAAyC,MAAM;IACjEH,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAW,KAAK,CACH,CAAC,MAAMb,IAAP,EAAa,MAAMC,IAAnB,CADG,EAEH,MAAM;IACJC,OAAO,CAACI,KAAR,GAAgBF,uBAAuB,CAACJ,IAAD,EAAOC,IAAP,CAAvC,CAAA;IACAQ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GALE,EAMH;AAAEY,IAAAA,IAAI,EAAE,IAAA;AAAR,GANG,CAAL,CAAA;AASAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOD,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,uBAAT,CACLJ,IADK,EAELC,IAAqB,GAAG,EAFnB,EAGL;AACA,EAAA,IAAIe,OAAJ,CAAA;;AAEA,EAAA,IAAIC,UAAU,CAACjB,IAAD,CAAd,EAAsB;IACpBgB,OAAO,GAAG,EAAE,GAAGf,IAAL;AAAWiB,MAAAA,WAAW,EAAElB,IAAAA;KAAlC,CAAA;AACD,GAFD,MAEO;AACL;IACAgB,OAAO,GAAGhB,IAAI,IAAI,EAAlB,CAAA;AACD,GAAA;;EAED,OAAOmB,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -1112,9 +1112,11 @@
|
|
|
1112
1112
|
this.isFetchingOptimistic = false;
|
|
1113
1113
|
},
|
|
1114
1114
|
onError,
|
|
1115
|
-
onFail: () => {
|
|
1115
|
+
onFail: (failureCount, error) => {
|
|
1116
1116
|
this.dispatch({
|
|
1117
|
-
type: 'failed'
|
|
1117
|
+
type: 'failed',
|
|
1118
|
+
failureCount,
|
|
1119
|
+
error
|
|
1118
1120
|
});
|
|
1119
1121
|
},
|
|
1120
1122
|
onPause: () => {
|
|
@@ -1142,7 +1144,8 @@
|
|
|
1142
1144
|
switch (action.type) {
|
|
1143
1145
|
case 'failed':
|
|
1144
1146
|
return { ...state,
|
|
1145
|
-
fetchFailureCount:
|
|
1147
|
+
fetchFailureCount: action.failureCount,
|
|
1148
|
+
fetchFailureReason: action.error
|
|
1146
1149
|
};
|
|
1147
1150
|
|
|
1148
1151
|
case 'pause':
|
|
@@ -1158,6 +1161,7 @@
|
|
|
1158
1161
|
case 'fetch':
|
|
1159
1162
|
return { ...state,
|
|
1160
1163
|
fetchFailureCount: 0,
|
|
1164
|
+
fetchFailureReason: null,
|
|
1161
1165
|
fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,
|
|
1162
1166
|
fetchStatus: canFetch(this.options.networkMode) ? 'fetching' : 'paused',
|
|
1163
1167
|
...(!state.dataUpdatedAt && {
|
|
@@ -1176,7 +1180,8 @@
|
|
|
1176
1180
|
status: 'success',
|
|
1177
1181
|
...(!action.manual && {
|
|
1178
1182
|
fetchStatus: 'idle',
|
|
1179
|
-
fetchFailureCount: 0
|
|
1183
|
+
fetchFailureCount: 0,
|
|
1184
|
+
fetchFailureReason: null
|
|
1180
1185
|
})
|
|
1181
1186
|
};
|
|
1182
1187
|
|
|
@@ -1193,6 +1198,7 @@
|
|
|
1193
1198
|
errorUpdateCount: state.errorUpdateCount + 1,
|
|
1194
1199
|
errorUpdatedAt: Date.now(),
|
|
1195
1200
|
fetchFailureCount: state.fetchFailureCount + 1,
|
|
1201
|
+
fetchFailureReason: error,
|
|
1196
1202
|
fetchStatus: 'idle',
|
|
1197
1203
|
status: 'error'
|
|
1198
1204
|
};
|
|
@@ -1237,6 +1243,7 @@
|
|
|
1237
1243
|
errorUpdateCount: 0,
|
|
1238
1244
|
errorUpdatedAt: 0,
|
|
1239
1245
|
fetchFailureCount: 0,
|
|
1246
|
+
fetchFailureReason: null,
|
|
1240
1247
|
fetchMeta: null,
|
|
1241
1248
|
isInvalidated: false,
|
|
1242
1249
|
status: hasData ? 'success' : 'loading',
|
|
@@ -1441,9 +1448,11 @@
|
|
|
1441
1448
|
|
|
1442
1449
|
return this.options.mutationFn(this.state.variables);
|
|
1443
1450
|
},
|
|
1444
|
-
onFail: () => {
|
|
1451
|
+
onFail: (failureCount, error) => {
|
|
1445
1452
|
this.dispatch({
|
|
1446
|
-
type: 'failed'
|
|
1453
|
+
type: 'failed',
|
|
1454
|
+
failureCount,
|
|
1455
|
+
error
|
|
1447
1456
|
});
|
|
1448
1457
|
},
|
|
1449
1458
|
onPause: () => {
|
|
@@ -1476,7 +1485,7 @@
|
|
|
1476
1485
|
variables: this.options.variables
|
|
1477
1486
|
}); // Notify cache callback
|
|
1478
1487
|
|
|
1479
|
-
(_this$mutationCache$c = (_this$mutationCache$c2 = this.mutationCache.config).onMutate) == null ? void 0 : _this$mutationCache$c.call(_this$mutationCache$c2, this.state.variables, this);
|
|
1488
|
+
await ((_this$mutationCache$c = (_this$mutationCache$c2 = this.mutationCache.config).onMutate) == null ? void 0 : _this$mutationCache$c.call(_this$mutationCache$c2, this.state.variables, this));
|
|
1480
1489
|
const context = await ((_this$options$onMutat = (_this$options = this.options).onMutate) == null ? void 0 : _this$options$onMutat.call(_this$options, this.state.variables));
|
|
1481
1490
|
|
|
1482
1491
|
if (context !== this.state.context) {
|
|
@@ -1490,7 +1499,7 @@
|
|
|
1490
1499
|
|
|
1491
1500
|
const data = await executeMutation(); // Notify cache callback
|
|
1492
1501
|
|
|
1493
|
-
(_this$mutationCache$c3 = (_this$mutationCache$c4 = this.mutationCache.config).onSuccess) == null ? void 0 : _this$mutationCache$c3.call(_this$mutationCache$c4, data, this.state.variables, this.state.context, this);
|
|
1502
|
+
await ((_this$mutationCache$c3 = (_this$mutationCache$c4 = this.mutationCache.config).onSuccess) == null ? void 0 : _this$mutationCache$c3.call(_this$mutationCache$c4, data, this.state.variables, this.state.context, this));
|
|
1494
1503
|
await ((_this$options$onSucce = (_this$options2 = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options2, data, this.state.variables, this.state.context));
|
|
1495
1504
|
await ((_this$options$onSettl = (_this$options3 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options3, data, null, this.state.variables, this.state.context));
|
|
1496
1505
|
this.dispatch({
|
|
@@ -1503,7 +1512,7 @@
|
|
|
1503
1512
|
var _this$mutationCache$c5, _this$mutationCache$c6, _this$options$onError, _this$options4, _this$options$onSettl2, _this$options5;
|
|
1504
1513
|
|
|
1505
1514
|
// Notify cache callback
|
|
1506
|
-
(_this$mutationCache$c5 = (_this$mutationCache$c6 = this.mutationCache.config).onError) == null ? void 0 : _this$mutationCache$c5.call(_this$mutationCache$c6, error, this.state.variables, this.state.context, this);
|
|
1515
|
+
await ((_this$mutationCache$c5 = (_this$mutationCache$c6 = this.mutationCache.config).onError) == null ? void 0 : _this$mutationCache$c5.call(_this$mutationCache$c6, error, this.state.variables, this.state.context, this));
|
|
1507
1516
|
|
|
1508
1517
|
if ("development" !== 'production') {
|
|
1509
1518
|
this.logger.error(error);
|
|
@@ -1526,7 +1535,8 @@
|
|
|
1526
1535
|
switch (action.type) {
|
|
1527
1536
|
case 'failed':
|
|
1528
1537
|
return { ...state,
|
|
1529
|
-
failureCount:
|
|
1538
|
+
failureCount: action.failureCount,
|
|
1539
|
+
failureReason: action.error
|
|
1530
1540
|
};
|
|
1531
1541
|
|
|
1532
1542
|
case 'pause':
|
|
@@ -1543,6 +1553,8 @@
|
|
|
1543
1553
|
return { ...state,
|
|
1544
1554
|
context: action.context,
|
|
1545
1555
|
data: undefined,
|
|
1556
|
+
failureCount: 0,
|
|
1557
|
+
failureReason: null,
|
|
1546
1558
|
error: null,
|
|
1547
1559
|
isPaused: !canFetch(this.options.networkMode),
|
|
1548
1560
|
status: 'loading',
|
|
@@ -1552,6 +1564,8 @@
|
|
|
1552
1564
|
case 'success':
|
|
1553
1565
|
return { ...state,
|
|
1554
1566
|
data: action.data,
|
|
1567
|
+
failureCount: 0,
|
|
1568
|
+
failureReason: null,
|
|
1555
1569
|
error: null,
|
|
1556
1570
|
status: 'success',
|
|
1557
1571
|
isPaused: false
|
|
@@ -1562,6 +1576,7 @@
|
|
|
1562
1576
|
data: undefined,
|
|
1563
1577
|
error: action.error,
|
|
1564
1578
|
failureCount: state.failureCount + 1,
|
|
1579
|
+
failureReason: action.error,
|
|
1565
1580
|
isPaused: false,
|
|
1566
1581
|
status: 'error'
|
|
1567
1582
|
};
|
|
@@ -1593,6 +1608,7 @@
|
|
|
1593
1608
|
data: undefined,
|
|
1594
1609
|
error: null,
|
|
1595
1610
|
failureCount: 0,
|
|
1611
|
+
failureReason: null,
|
|
1596
1612
|
isPaused: false,
|
|
1597
1613
|
status: 'idle',
|
|
1598
1614
|
variables: undefined
|
|
@@ -2494,6 +2510,7 @@
|
|
|
2494
2510
|
error,
|
|
2495
2511
|
errorUpdatedAt,
|
|
2496
2512
|
failureCount: state.fetchFailureCount,
|
|
2513
|
+
failureReason: state.fetchFailureReason,
|
|
2497
2514
|
errorUpdateCount: state.errorUpdateCount,
|
|
2498
2515
|
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
2499
2516
|
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
@@ -4794,6 +4811,7 @@
|
|
|
4794
4811
|
queryKey: arg1
|
|
4795
4812
|
};
|
|
4796
4813
|
} else {
|
|
4814
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
4797
4815
|
options = arg1 || {};
|
|
4798
4816
|
}
|
|
4799
4817
|
|
|
@@ -4828,6 +4846,7 @@
|
|
|
4828
4846
|
mutationKey: arg1
|
|
4829
4847
|
};
|
|
4830
4848
|
} else {
|
|
4849
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
4831
4850
|
options = arg1 || {};
|
|
4832
4851
|
}
|
|
4833
4852
|
|