@tanstack/vue-query 4.15.1 → 4.17.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/build/lib/__mocks__/useBaseQuery.d.ts +1 -0
- package/build/lib/devtools/devtools.esm.js +1 -1
- package/build/lib/devtools/devtools.esm.js.map +1 -1
- package/build/lib/devtools/devtools.js +1 -1
- package/build/lib/devtools/devtools.js.map +1 -1
- package/build/lib/devtools/devtools.mjs +1 -1
- package/build/lib/devtools/devtools.mjs.map +1 -1
- package/build/lib/queryClient.d.ts +1 -0
- package/build/lib/queryClient.esm.js +2 -0
- package/build/lib/queryClient.esm.js.map +1 -1
- package/build/lib/queryClient.js +2 -0
- package/build/lib/queryClient.js.map +1 -1
- package/build/lib/queryClient.mjs +2 -0
- package/build/lib/queryClient.mjs.map +1 -1
- package/build/lib/useBaseQuery.d.ts +4 -2
- package/build/lib/useBaseQuery.esm.js +55 -42
- package/build/lib/useBaseQuery.esm.js.map +1 -1
- package/build/lib/useBaseQuery.js +54 -40
- package/build/lib/useBaseQuery.js.map +1 -1
- package/build/lib/useBaseQuery.mjs +55 -42
- package/build/lib/useBaseQuery.mjs.map +1 -1
- package/build/lib/useIsFetching.d.ts +3 -3
- package/build/lib/useIsFetching.esm.js +10 -9
- package/build/lib/useIsFetching.esm.js.map +1 -1
- package/build/lib/useIsFetching.js +9 -8
- package/build/lib/useIsFetching.js.map +1 -1
- package/build/lib/useIsFetching.mjs +10 -9
- package/build/lib/useIsFetching.mjs.map +1 -1
- package/build/lib/useIsMutating.d.ts +3 -3
- package/build/lib/useIsMutating.esm.js +12 -11
- package/build/lib/useIsMutating.esm.js.map +1 -1
- package/build/lib/useIsMutating.js +11 -10
- package/build/lib/useIsMutating.js.map +1 -1
- package/build/lib/useIsMutating.mjs +12 -11
- package/build/lib/useIsMutating.mjs.map +1 -1
- package/build/lib/useQueries.esm.js +29 -17
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +28 -16
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +29 -17
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/vueQueryPlugin.d.ts +7 -9
- package/build/lib/vueQueryPlugin.esm.js +13 -0
- package/build/lib/vueQueryPlugin.esm.js.map +1 -1
- package/build/lib/vueQueryPlugin.js +13 -0
- package/build/lib/vueQueryPlugin.js.map +1 -1
- package/build/lib/vueQueryPlugin.mjs +13 -0
- package/build/lib/vueQueryPlugin.mjs.map +1 -1
- package/build/umd/index.development.js +133 -92
- 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 +6 -2
|
@@ -1,45 +1,63 @@
|
|
|
1
|
-
import { reactive, watch, onScopeDispose, toRefs, readonly } from 'vue-demi';
|
|
1
|
+
import { computed, reactive, ref, watch, onScopeDispose, toRefs, readonly, isRef } from 'vue-demi';
|
|
2
2
|
import { useQueryClient } from './useQueryClient.mjs';
|
|
3
3
|
import { updateState, isQueryKey, cloneDeepUnref } from './utils.mjs';
|
|
4
4
|
|
|
5
5
|
function useBaseQuery(Observer, arg1, arg2 = {}, arg3 = {}) {
|
|
6
|
-
var _options$
|
|
6
|
+
var _options$value$queryC;
|
|
7
7
|
|
|
8
|
-
const options =
|
|
9
|
-
const queryClient = (_options$
|
|
10
|
-
const defaultedOptions =
|
|
11
|
-
|
|
8
|
+
const options = computed(() => parseQueryArgs(arg1, arg2, arg3));
|
|
9
|
+
const queryClient = (_options$value$queryC = options.value.queryClient) != null ? _options$value$queryC : useQueryClient(options.value.queryClientKey);
|
|
10
|
+
const defaultedOptions = computed(() => {
|
|
11
|
+
const defaulted = queryClient.defaultQueryOptions(options.value);
|
|
12
|
+
defaulted._optimisticResults = queryClient.isRestoring.value ? 'isRestoring' : 'optimistic';
|
|
13
|
+
return defaulted;
|
|
14
|
+
});
|
|
15
|
+
const observer = new Observer(queryClient, defaultedOptions.value);
|
|
12
16
|
const state = reactive(observer.getCurrentResult());
|
|
13
|
-
const unsubscribe =
|
|
14
|
-
|
|
17
|
+
const unsubscribe = ref(() => {// noop
|
|
18
|
+
});
|
|
19
|
+
watch(queryClient.isRestoring, isRestoring => {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
21
|
+
if (!isRestoring) {
|
|
22
|
+
unsubscribe.value();
|
|
23
|
+
unsubscribe.value = observer.subscribe(result => {
|
|
24
|
+
updateState(state, result);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
immediate: true
|
|
15
29
|
});
|
|
16
|
-
watch(
|
|
17
|
-
observer.setOptions(
|
|
30
|
+
watch(defaultedOptions, () => {
|
|
31
|
+
observer.setOptions(defaultedOptions.value);
|
|
32
|
+
updateState(state, observer.getCurrentResult());
|
|
18
33
|
}, {
|
|
19
34
|
deep: true
|
|
20
35
|
});
|
|
21
36
|
onScopeDispose(() => {
|
|
22
|
-
unsubscribe();
|
|
37
|
+
unsubscribe.value();
|
|
23
38
|
});
|
|
24
39
|
|
|
25
40
|
const suspense = () => {
|
|
26
41
|
return new Promise(resolve => {
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
let stopWatch = () => {//noop
|
|
43
|
+
};
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
const run = () => {
|
|
46
|
+
if (defaultedOptions.value.enabled !== false) {
|
|
47
|
+
const optimisticResult = observer.getOptimisticResult(defaultedOptions.value);
|
|
32
48
|
|
|
33
49
|
if (optimisticResult.isStale) {
|
|
34
|
-
|
|
50
|
+
stopWatch();
|
|
51
|
+
resolve(observer.fetchOptimistic(defaultedOptions.value));
|
|
35
52
|
} else {
|
|
53
|
+
stopWatch();
|
|
36
54
|
resolve(optimisticResult);
|
|
37
55
|
}
|
|
38
56
|
}
|
|
39
57
|
};
|
|
40
58
|
|
|
41
59
|
run();
|
|
42
|
-
|
|
60
|
+
stopWatch = watch(defaultedOptions, run, {
|
|
43
61
|
deep: true
|
|
44
62
|
});
|
|
45
63
|
});
|
|
@@ -48,33 +66,28 @@ function useBaseQuery(Observer, arg1, arg2 = {}, arg3 = {}) {
|
|
|
48
66
|
return { ...toRefs(readonly(state)),
|
|
49
67
|
suspense
|
|
50
68
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let mergedOptions;
|
|
58
|
-
|
|
59
|
-
if (!isQueryKey(arg1)) {
|
|
60
|
-
// `useQuery(optionsObj)`
|
|
61
|
-
mergedOptions = arg1;
|
|
62
|
-
} else if (typeof arg2 === 'function') {
|
|
63
|
-
// `useQuery(queryKey, queryFn, optionsObj?)`
|
|
64
|
-
mergedOptions = { ...arg3,
|
|
65
|
-
queryKey: arg1,
|
|
66
|
-
queryFn: arg2
|
|
67
|
-
};
|
|
68
|
-
} else {
|
|
69
|
-
// `useQuery(queryKey, optionsObj?)`
|
|
70
|
-
mergedOptions = { ...arg2,
|
|
71
|
-
queryKey: arg1
|
|
72
|
-
};
|
|
73
|
-
}
|
|
69
|
+
}
|
|
70
|
+
function parseQueryArgs(arg1, arg2 = {}, arg3 = {}) {
|
|
71
|
+
const plainArg1 = isRef(arg1) ? arg1.value : arg1;
|
|
72
|
+
const plainArg2 = isRef(arg2) ? arg2.value : arg2;
|
|
73
|
+
const plainArg3 = isRef(arg3) ? arg3.value : arg3;
|
|
74
|
+
let options = plainArg1;
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
if (!isQueryKey(plainArg1)) {
|
|
77
|
+
options = plainArg1;
|
|
78
|
+
} else if (typeof plainArg2 === 'function') {
|
|
79
|
+
options = { ...plainArg3,
|
|
80
|
+
queryKey: plainArg1,
|
|
81
|
+
queryFn: plainArg2
|
|
82
|
+
};
|
|
83
|
+
} else {
|
|
84
|
+
options = { ...plainArg2,
|
|
85
|
+
queryKey: plainArg1
|
|
86
|
+
};
|
|
76
87
|
}
|
|
88
|
+
|
|
89
|
+
return cloneDeepUnref(options);
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
export { useBaseQuery };
|
|
92
|
+
export { parseQueryArgs, useBaseQuery };
|
|
80
93
|
//# sourceMappingURL=useBaseQuery.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseQuery.mjs","sources":["../../src/useBaseQuery.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useBaseQuery.mjs","sources":["../../src/useBaseQuery.ts"],"sourcesContent":["import {\n onScopeDispose,\n toRefs,\n readonly,\n reactive,\n watch,\n ref,\n computed,\n isRef,\n} from 'vue-demi'\nimport type { ToRefs, UnwrapRef } from 'vue-demi'\nimport type {\n QueryObserver,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n QueryFunction,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './useQueryClient'\nimport { updateState, isQueryKey, cloneDeepUnref } from './utils'\nimport type { MaybeRef, WithQueryClientKey } from './types'\nimport type { UseQueryOptions } from './useQuery'\nimport type { UseInfiniteQueryOptions } from './useInfiniteQuery'\n\nexport type UseQueryReturnType<\n TData,\n TError,\n Result = QueryObserverResult<TData, TError>,\n> = ToRefs<Readonly<Result>> & {\n suspense: () => Promise<Result>\n}\n\ntype UseQueryOptionsGeneric<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey = QueryKey,\n> =\n | UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n | UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryKey extends QueryKey,\n>(\n Observer: typeof QueryObserver,\n arg1:\n | TQueryKey\n | UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey>,\n arg2:\n | QueryFunction<TQueryFnData, UnwrapRef<TQueryKey>>\n | UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey> = {},\n arg3: UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey> = {},\n): UseQueryReturnType<TData, TError> {\n const options = computed(() => parseQueryArgs(arg1, arg2, arg3))\n\n const queryClient =\n options.value.queryClient ?? useQueryClient(options.value.queryClientKey)\n\n const defaultedOptions = computed(() => {\n const defaulted = queryClient.defaultQueryOptions(options.value)\n defaulted._optimisticResults = queryClient.isRestoring.value\n ? 'isRestoring'\n : 'optimistic'\n\n return defaulted\n })\n\n const observer = new Observer(queryClient, defaultedOptions.value)\n const state = reactive(observer.getCurrentResult())\n\n const unsubscribe = ref(() => {\n // noop\n })\n\n watch(\n queryClient.isRestoring,\n (isRestoring) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isRestoring) {\n unsubscribe.value()\n unsubscribe.value = observer.subscribe((result) => {\n updateState(state, result)\n })\n }\n },\n { immediate: true },\n )\n\n watch(\n defaultedOptions,\n () => {\n observer.setOptions(defaultedOptions.value)\n updateState(state, observer.getCurrentResult())\n },\n { deep: true },\n )\n\n onScopeDispose(() => {\n unsubscribe.value()\n })\n\n const suspense = () => {\n return new Promise<QueryObserverResult<TData, TError>>((resolve) => {\n let stopWatch = () => {\n //noop\n }\n const run = () => {\n if (defaultedOptions.value.enabled !== false) {\n const optimisticResult = observer.getOptimisticResult(\n defaultedOptions.value,\n )\n if (optimisticResult.isStale) {\n stopWatch()\n resolve(observer.fetchOptimistic(defaultedOptions.value))\n } else {\n stopWatch()\n resolve(optimisticResult)\n }\n }\n }\n\n run()\n\n stopWatch = watch(defaultedOptions, run, { deep: true })\n })\n }\n\n return {\n ...(toRefs(readonly(state)) as UseQueryReturnType<TData, TError>),\n suspense,\n }\n}\n\nexport function parseQueryArgs<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n arg1:\n | MaybeRef<TQueryKey>\n | MaybeRef<UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey>>,\n arg2:\n | MaybeRef<QueryFunction<TQueryFnData, UnwrapRef<TQueryKey>>>\n | MaybeRef<\n UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey>\n > = {},\n arg3: MaybeRef<\n UseQueryOptionsGeneric<TQueryFnData, TError, TData, TQueryKey>\n > = {},\n): WithQueryClientKey<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>\n> {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n const plainArg3 = isRef(arg3) ? arg3.value : arg3\n\n let options = plainArg1\n\n if (!isQueryKey(plainArg1)) {\n options = plainArg1\n } else if (typeof plainArg2 === 'function') {\n options = { ...plainArg3, queryKey: plainArg1, queryFn: plainArg2 }\n } else {\n options = { ...plainArg2, queryKey: plainArg1 }\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>\n >\n}\n"],"names":["useBaseQuery","Observer","arg1","arg2","arg3","options","computed","parseQueryArgs","queryClient","value","useQueryClient","queryClientKey","defaultedOptions","defaulted","defaultQueryOptions","_optimisticResults","isRestoring","observer","state","reactive","getCurrentResult","unsubscribe","ref","watch","subscribe","result","updateState","immediate","setOptions","deep","onScopeDispose","suspense","Promise","resolve","stopWatch","run","enabled","optimisticResult","getOptimisticResult","isStale","fetchOptimistic","toRefs","readonly","plainArg1","isRef","plainArg2","plainArg3","isQueryKey","queryKey","queryFn","cloneDeepUnref"],"mappings":";;;;AAyCO,SAASA,YAAT,CAMLC,QANK,EAOLC,IAPK,EAULC,IAEkE,GAAG,EAZhE,EAaLC,IAAoE,GAAG,EAblE,EAc8B;AAAA,EAAA,IAAA,qBAAA,CAAA;;AACnC,EAAA,MAAMC,OAAO,GAAGC,QAAQ,CAAC,MAAMC,cAAc,CAACL,IAAD,EAAOC,IAAP,EAAaC,IAAb,CAArB,CAAxB,CAAA;AAEA,EAAA,MAAMI,WAAW,GAAA,CAAA,qBAAA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GAAGC,KAAK,CAAC1C,IAAD,CAAL,GAAcA,IAAI,CAACO,KAAnB,GAA2BP,IAA7C,CAAA;EACA,MAAM2C,SAAS,GAAGD,KAAK,CAACzC,IAAD,CAAL,GAAcA,IAAI,CAACM,KAAnB,GAA2BN,IAA7C,CAAA;EACA,MAAM2C,SAAS,GAAGF,KAAK,CAACxC,IAAD,CAAL,GAAcA,IAAI,CAACK,KAAnB,GAA2BL,IAA7C,CAAA;EAEA,IAAIC,OAAO,GAAGsC,SAAd,CAAA;;AAEA,EAAA,IAAI,CAACI,UAAU,CAACJ,SAAD,CAAf,EAA4B;AAC1BtC,IAAAA,OAAO,GAAGsC,SAAV,CAAA;AACD,GAFD,MAEO,IAAI,OAAOE,SAAP,KAAqB,UAAzB,EAAqC;IAC1CxC,OAAO,GAAG,EAAE,GAAGyC,SAAL;AAAgBE,MAAAA,QAAQ,EAAEL,SAA1B;AAAqCM,MAAAA,OAAO,EAAEJ,SAAAA;KAAxD,CAAA;AACD,GAFM,MAEA;IACLxC,OAAO,GAAG,EAAE,GAAGwC,SAAL;AAAgBG,MAAAA,QAAQ,EAAEL,SAAAA;KAApC,CAAA;AACD,GAAA;;EAED,OAAOO,cAAc,CAAC7C,OAAD,CAArB,CAAA;AAGD;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from 'vue-demi';
|
|
2
2
|
import type { QueryKey, QueryFilters as QF } from '@tanstack/query-core';
|
|
3
|
-
import type { MaybeRefDeep, WithQueryClientKey } from './types';
|
|
3
|
+
import type { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types';
|
|
4
4
|
export declare type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>;
|
|
5
5
|
export declare function useIsFetching(filters?: QueryFilters): Ref<number>;
|
|
6
|
-
export declare function useIsFetching(queryKey?: QueryKey
|
|
7
|
-
export declare function parseFilterArgs(arg1?: QueryKey | QueryFilters, arg2?: QueryFilters): WithQueryClientKey<QF>;
|
|
6
|
+
export declare function useIsFetching(queryKey?: MaybeRef<QueryKey>, filters?: Omit<QueryFilters, 'queryKey'>): Ref<number>;
|
|
7
|
+
export declare function parseFilterArgs(arg1?: MaybeRef<QueryKey> | QueryFilters, arg2?: QueryFilters): WithQueryClientKey<QF>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ref, watch, onScopeDispose } from 'vue-demi';
|
|
1
|
+
import { computed, ref, watch, onScopeDispose, isRef } from 'vue-demi';
|
|
2
2
|
import { useQueryClient } from './useQueryClient.esm.js';
|
|
3
3
|
import { isQueryKey, cloneDeepUnref } from './utils.esm.js';
|
|
4
4
|
|
|
5
5
|
function useIsFetching(arg1, arg2) {
|
|
6
6
|
var _filters$value$queryC;
|
|
7
7
|
|
|
8
|
-
const filters =
|
|
8
|
+
const filters = computed(() => parseFilterArgs(arg1, arg2));
|
|
9
9
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
10
10
|
const isFetching = ref(queryClient.isFetching(filters));
|
|
11
11
|
const unsubscribe = queryClient.getQueryCache().subscribe(() => {
|
|
12
12
|
isFetching.value = queryClient.isFetching(filters);
|
|
13
13
|
});
|
|
14
|
-
watch(
|
|
15
|
-
filters.value = parseFilterArgs(arg1, arg2);
|
|
14
|
+
watch(filters, () => {
|
|
16
15
|
isFetching.value = queryClient.isFetching(filters);
|
|
17
16
|
}, {
|
|
18
17
|
deep: true
|
|
@@ -23,15 +22,17 @@ function useIsFetching(arg1, arg2) {
|
|
|
23
22
|
return isFetching;
|
|
24
23
|
}
|
|
25
24
|
function parseFilterArgs(arg1, arg2 = {}) {
|
|
26
|
-
|
|
25
|
+
const plainArg1 = isRef(arg1) ? arg1.value : arg1;
|
|
26
|
+
const plainArg2 = isRef(arg2) ? arg2.value : arg2;
|
|
27
|
+
let options = plainArg1;
|
|
27
28
|
|
|
28
|
-
if (isQueryKey(
|
|
29
|
-
options = { ...
|
|
30
|
-
queryKey:
|
|
29
|
+
if (isQueryKey(plainArg1)) {
|
|
30
|
+
options = { ...plainArg2,
|
|
31
|
+
queryKey: plainArg1
|
|
31
32
|
};
|
|
32
33
|
} else {
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
34
|
-
options =
|
|
35
|
+
options = plainArg1 || {};
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
return cloneDeepUnref(options);
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"useIsFetching.esm.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { computed, isRef, 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 { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: MaybeRef<QueryKey>,\n filters?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number>\nexport function useIsFetching(\n arg1?: MaybeRef<QueryKey> | QueryFilters,\n arg2?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number> {\n const filters = computed(() => 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 filters,\n () => {\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?: MaybeRef<QueryKey> | QueryFilters,\n arg2: QueryFilters = {},\n) {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n\n let options = plainArg1\n\n if (isQueryKey(plainArg1)) {\n options = { ...plainArg2, queryKey: plainArg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = plainArg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","computed","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","ref","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","plainArg1","isRef","plainArg2","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,QAAQ,CAAC,MAAMC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAtB,CAAxB,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,GAAGC,GAAG,CAACL,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMS,WAAW,GAAGN,WAAW,CAACO,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DJ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAY,KAAK,CACHZ,OADG,EAEH,MAAM;IACJO,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAJE,EAKH;AAAEa,IAAAA,IAAI,EAAE,IAAA;AAAR,GALG,CAAL,CAAA;AAQAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOF,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;EACA,MAAMgB,SAAS,GAAGC,KAAK,CAAClB,IAAD,CAAL,GAAcA,IAAI,CAACM,KAAnB,GAA2BN,IAA7C,CAAA;EACA,MAAMmB,SAAS,GAAGD,KAAK,CAACjB,IAAD,CAAL,GAAcA,IAAI,CAACK,KAAnB,GAA2BL,IAA7C,CAAA;EAEA,IAAImB,OAAO,GAAGH,SAAd,CAAA;;AAEA,EAAA,IAAII,UAAU,CAACJ,SAAD,CAAd,EAA2B;IACzBG,OAAO,GAAG,EAAE,GAAGD,SAAL;AAAgBG,MAAAA,QAAQ,EAAEL,SAAAA;KAApC,CAAA;AACD,GAFD,MAEO;AACL;IACAG,OAAO,GAAGH,SAAS,IAAI,EAAvB,CAAA;AACD,GAAA;;EAED,OAAOM,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -9,14 +9,13 @@ var utils = require('./utils.js');
|
|
|
9
9
|
function useIsFetching(arg1, arg2) {
|
|
10
10
|
var _filters$value$queryC;
|
|
11
11
|
|
|
12
|
-
const filters = vueDemi.
|
|
12
|
+
const filters = vueDemi.computed(() => parseFilterArgs(arg1, arg2));
|
|
13
13
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient.useQueryClient(filters.value.queryClientKey);
|
|
14
14
|
const isFetching = vueDemi.ref(queryClient.isFetching(filters));
|
|
15
15
|
const unsubscribe = queryClient.getQueryCache().subscribe(() => {
|
|
16
16
|
isFetching.value = queryClient.isFetching(filters);
|
|
17
17
|
});
|
|
18
|
-
vueDemi.watch(
|
|
19
|
-
filters.value = parseFilterArgs(arg1, arg2);
|
|
18
|
+
vueDemi.watch(filters, () => {
|
|
20
19
|
isFetching.value = queryClient.isFetching(filters);
|
|
21
20
|
}, {
|
|
22
21
|
deep: true
|
|
@@ -27,15 +26,17 @@ function useIsFetching(arg1, arg2) {
|
|
|
27
26
|
return isFetching;
|
|
28
27
|
}
|
|
29
28
|
function parseFilterArgs(arg1, arg2 = {}) {
|
|
30
|
-
|
|
29
|
+
const plainArg1 = vueDemi.isRef(arg1) ? arg1.value : arg1;
|
|
30
|
+
const plainArg2 = vueDemi.isRef(arg2) ? arg2.value : arg2;
|
|
31
|
+
let options = plainArg1;
|
|
31
32
|
|
|
32
|
-
if (utils.isQueryKey(
|
|
33
|
-
options = { ...
|
|
34
|
-
queryKey:
|
|
33
|
+
if (utils.isQueryKey(plainArg1)) {
|
|
34
|
+
options = { ...plainArg2,
|
|
35
|
+
queryKey: plainArg1
|
|
35
36
|
};
|
|
36
37
|
} else {
|
|
37
38
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
38
|
-
options =
|
|
39
|
+
options = plainArg1 || {};
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
return utils.cloneDeepUnref(options);
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"useIsFetching.js","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { computed, isRef, 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 { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: MaybeRef<QueryKey>,\n filters?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number>\nexport function useIsFetching(\n arg1?: MaybeRef<QueryKey> | QueryFilters,\n arg2?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number> {\n const filters = computed(() => 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 filters,\n () => {\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?: MaybeRef<QueryKey> | QueryFilters,\n arg2: QueryFilters = {},\n) {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n\n let options = plainArg1\n\n if (isQueryKey(plainArg1)) {\n options = { ...plainArg2, queryKey: plainArg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = plainArg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","computed","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","ref","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","plainArg1","isRef","plainArg2","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;;;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,gBAAQ,CAAC,MAAMC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAtB,CAAxB,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,GAAGC,WAAG,CAACL,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMS,WAAW,GAAGN,WAAW,CAACO,aAAZ,EAA4BC,CAAAA,SAA5B,CAAsC,MAAM;IAC9DJ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAY,aAAK,CACHZ,OADG,EAEH,MAAM;IACJO,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAJE,EAKH;AAAEa,IAAAA,IAAI,EAAE,IAAA;AAAR,GALG,CAAL,CAAA;AAQAC,EAAAA,sBAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOF,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAkB,GAAG,EAFhB,EAGL;EACA,MAAMgB,SAAS,GAAGC,aAAK,CAAClB,IAAD,CAAL,GAAcA,IAAI,CAACM,KAAnB,GAA2BN,IAA7C,CAAA;EACA,MAAMmB,SAAS,GAAGD,aAAK,CAACjB,IAAD,CAAL,GAAcA,IAAI,CAACK,KAAnB,GAA2BL,IAA7C,CAAA;EAEA,IAAImB,OAAO,GAAGH,SAAd,CAAA;;AAEA,EAAA,IAAII,gBAAU,CAACJ,SAAD,CAAd,EAA2B;IACzBG,OAAO,GAAG,EAAE,GAAGD,SAAL;AAAgBG,MAAAA,QAAQ,EAAEL,SAAAA;KAApC,CAAA;AACD,GAFD,MAEO;AACL;IACAG,OAAO,GAAGH,SAAS,IAAI,EAAvB,CAAA;AACD,GAAA;;EAED,OAAOM,oBAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;;"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ref, watch, onScopeDispose } from 'vue-demi';
|
|
1
|
+
import { computed, ref, watch, onScopeDispose, isRef } from 'vue-demi';
|
|
2
2
|
import { useQueryClient } from './useQueryClient.mjs';
|
|
3
3
|
import { isQueryKey, cloneDeepUnref } from './utils.mjs';
|
|
4
4
|
|
|
5
5
|
function useIsFetching(arg1, arg2) {
|
|
6
6
|
var _filters$value$queryC;
|
|
7
7
|
|
|
8
|
-
const filters =
|
|
8
|
+
const filters = computed(() => parseFilterArgs(arg1, arg2));
|
|
9
9
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
10
10
|
const isFetching = ref(queryClient.isFetching(filters));
|
|
11
11
|
const unsubscribe = queryClient.getQueryCache().subscribe(() => {
|
|
12
12
|
isFetching.value = queryClient.isFetching(filters);
|
|
13
13
|
});
|
|
14
|
-
watch(
|
|
15
|
-
filters.value = parseFilterArgs(arg1, arg2);
|
|
14
|
+
watch(filters, () => {
|
|
16
15
|
isFetching.value = queryClient.isFetching(filters);
|
|
17
16
|
}, {
|
|
18
17
|
deep: true
|
|
@@ -23,15 +22,17 @@ function useIsFetching(arg1, arg2) {
|
|
|
23
22
|
return isFetching;
|
|
24
23
|
}
|
|
25
24
|
function parseFilterArgs(arg1, arg2 = {}) {
|
|
26
|
-
|
|
25
|
+
const plainArg1 = isRef(arg1) ? arg1.value : arg1;
|
|
26
|
+
const plainArg2 = isRef(arg2) ? arg2.value : arg2;
|
|
27
|
+
let options = plainArg1;
|
|
27
28
|
|
|
28
|
-
if (isQueryKey(
|
|
29
|
-
options = { ...
|
|
30
|
-
queryKey:
|
|
29
|
+
if (isQueryKey(plainArg1)) {
|
|
30
|
+
options = { ...plainArg2,
|
|
31
|
+
queryKey: plainArg1
|
|
31
32
|
};
|
|
32
33
|
} else {
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
34
|
-
options =
|
|
35
|
+
options = plainArg1 || {};
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
return cloneDeepUnref(options);
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"useIsFetching.mjs","sources":["../../src/useIsFetching.ts"],"sourcesContent":["import { computed, isRef, 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 { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type QueryFilters = MaybeRefDeep<WithQueryClientKey<QF>>\n\nexport function useIsFetching(filters?: QueryFilters): Ref<number>\nexport function useIsFetching(\n queryKey?: MaybeRef<QueryKey>,\n filters?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number>\nexport function useIsFetching(\n arg1?: MaybeRef<QueryKey> | QueryFilters,\n arg2?: Omit<QueryFilters, 'queryKey'>,\n): Ref<number> {\n const filters = computed(() => 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 filters,\n () => {\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?: MaybeRef<QueryKey> | QueryFilters,\n arg2: QueryFilters = {},\n) {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n\n let options = plainArg1\n\n if (isQueryKey(plainArg1)) {\n options = { ...plainArg2, queryKey: plainArg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = plainArg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<QF>\n}\n"],"names":["useIsFetching","arg1","arg2","filters","computed","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isFetching","ref","unsubscribe","getQueryCache","subscribe","watch","deep","onScopeDispose","plainArg1","isRef","plainArg2","options","isQueryKey","queryKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA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D,CAAd,EAA2B;IACzBG,OAAO,GAAG,EAAE,GAAGD,SAAL;AAAgBG,MAAAA,QAAQ,EAAEL,SAAAA;KAApC,CAAA;AACD,GAFD,MAEO;AACL;IACAG,OAAO,GAAGH,SAAS,IAAI,EAAvB,CAAA;AACD,GAAA;;EAED,OAAOM,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from 'vue-demi';
|
|
2
2
|
import type { MutationKey, MutationFilters as MF } from '@tanstack/query-core';
|
|
3
|
-
import type { MaybeRefDeep, WithQueryClientKey } from './types';
|
|
3
|
+
import type { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types';
|
|
4
4
|
export declare type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>;
|
|
5
5
|
export declare function useIsMutating(filters?: MutationFilters): Ref<number>;
|
|
6
|
-
export declare function useIsMutating(mutationKey?: MutationKey
|
|
7
|
-
export declare function
|
|
6
|
+
export declare function useIsMutating(mutationKey?: MaybeRef<MutationKey>, filters?: Omit<MutationFilters, 'mutationKey'>): Ref<number>;
|
|
7
|
+
export declare function parseFilterArgs(arg1?: MaybeRef<MutationKey> | MutationFilters, arg2?: MutationFilters): WithQueryClientKey<MF>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ref, watch, onScopeDispose } from 'vue-demi';
|
|
1
|
+
import { computed, ref, watch, onScopeDispose, isRef } from 'vue-demi';
|
|
2
2
|
import { useQueryClient } from './useQueryClient.esm.js';
|
|
3
3
|
import { isQueryKey, cloneDeepUnref } from './utils.esm.js';
|
|
4
4
|
|
|
5
5
|
function useIsMutating(arg1, arg2) {
|
|
6
6
|
var _filters$value$queryC;
|
|
7
7
|
|
|
8
|
-
const filters =
|
|
8
|
+
const filters = computed(() => parseFilterArgs(arg1, arg2));
|
|
9
9
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
10
10
|
const isMutating = ref(queryClient.isMutating(filters));
|
|
11
11
|
const unsubscribe = queryClient.getMutationCache().subscribe(() => {
|
|
12
12
|
isMutating.value = queryClient.isMutating(filters);
|
|
13
13
|
});
|
|
14
|
-
watch(
|
|
15
|
-
filters.value = parseMutationFilterArgs(arg1, arg2);
|
|
14
|
+
watch(filters, () => {
|
|
16
15
|
isMutating.value = queryClient.isMutating(filters);
|
|
17
16
|
}, {
|
|
18
17
|
deep: true
|
|
@@ -22,20 +21,22 @@ function useIsMutating(arg1, arg2) {
|
|
|
22
21
|
});
|
|
23
22
|
return isMutating;
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
24
|
+
function parseFilterArgs(arg1, arg2 = {}) {
|
|
25
|
+
const plainArg1 = isRef(arg1) ? arg1.value : arg1;
|
|
26
|
+
const plainArg2 = isRef(arg2) ? arg2.value : arg2;
|
|
27
|
+
let options = plainArg1;
|
|
27
28
|
|
|
28
|
-
if (isQueryKey(
|
|
29
|
-
options = { ...
|
|
30
|
-
mutationKey:
|
|
29
|
+
if (isQueryKey(plainArg1)) {
|
|
30
|
+
options = { ...plainArg2,
|
|
31
|
+
mutationKey: plainArg1
|
|
31
32
|
};
|
|
32
33
|
} else {
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
34
|
-
options =
|
|
35
|
+
options = plainArg1 || {};
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
return cloneDeepUnref(options);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
export {
|
|
41
|
+
export { parseFilterArgs, useIsMutating };
|
|
41
42
|
//# sourceMappingURL=useIsMutating.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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
|
|
1
|
+
{"version":3,"file":"useIsMutating.esm.js","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { computed, isRef, 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 { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MaybeRef<MutationKey>,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MaybeRef<MutationKey> | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = computed(() => parseFilterArgs(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 filters,\n () => {\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 parseFilterArgs(\n arg1?: MaybeRef<MutationKey> | MutationFilters,\n arg2: MutationFilters = {},\n) {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n\n let options = plainArg1\n\n if (isQueryKey(plainArg1)) {\n options = { ...plainArg2, mutationKey: plainArg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = plainArg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","computed","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","ref","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","plainArg1","isRef","plainArg2","options","isQueryKey","mutationKey","cloneDeepUnref"],"mappings":";;;;AAeO,SAASA,aAAT,CACLC,IADK,EAELC,IAFK,EAGQ;AAAA,EAAA,IAAA,qBAAA,CAAA;;EACb,MAAMC,OAAO,GAAGC,QAAQ,CAAC,MAAMC,eAAe,CAACJ,IAAD,EAAOC,IAAP,CAAtB,CAAxB,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,GAAGC,GAAG,CAACL,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAD,CAAtB,CAAA;EAEA,MAAMS,WAAW,GAAGN,WAAW,CAACO,gBAAZ,EAA+BC,CAAAA,SAA/B,CAAyC,MAAM;IACjEJ,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAFmB,CAApB,CAAA;EAIAY,KAAK,CACHZ,OADG,EAEH,MAAM;IACJO,UAAU,CAACH,KAAX,GAAmBD,WAAW,CAACI,UAAZ,CAAuBP,OAAvB,CAAnB,CAAA;AACD,GAJE,EAKH;AAAEa,IAAAA,IAAI,EAAE,IAAA;AAAR,GALG,CAAL,CAAA;AAQAC,EAAAA,cAAc,CAAC,MAAM;IACnBL,WAAW,EAAA,CAAA;AACZ,GAFa,CAAd,CAAA;AAIA,EAAA,OAAOF,UAAP,CAAA;AACD,CAAA;AAEM,SAASL,eAAT,CACLJ,IADK,EAELC,IAAqB,GAAG,EAFnB,EAGL;EACA,MAAMgB,SAAS,GAAGC,KAAK,CAAClB,IAAD,CAAL,GAAcA,IAAI,CAACM,KAAnB,GAA2BN,IAA7C,CAAA;EACA,MAAMmB,SAAS,GAAGD,KAAK,CAACjB,IAAD,CAAL,GAAcA,IAAI,CAACK,KAAnB,GAA2BL,IAA7C,CAAA;EAEA,IAAImB,OAAO,GAAGH,SAAd,CAAA;;AAEA,EAAA,IAAII,UAAU,CAACJ,SAAD,CAAd,EAA2B;IACzBG,OAAO,GAAG,EAAE,GAAGD,SAAL;AAAgBG,MAAAA,WAAW,EAAEL,SAAAA;KAAvC,CAAA;AACD,GAFD,MAEO;AACL;IACAG,OAAO,GAAGH,SAAS,IAAI,EAAvB,CAAA;AACD,GAAA;;EAED,OAAOM,cAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;"}
|
|
@@ -9,14 +9,13 @@ var utils = require('./utils.js');
|
|
|
9
9
|
function useIsMutating(arg1, arg2) {
|
|
10
10
|
var _filters$value$queryC;
|
|
11
11
|
|
|
12
|
-
const filters = vueDemi.
|
|
12
|
+
const filters = vueDemi.computed(() => parseFilterArgs(arg1, arg2));
|
|
13
13
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient.useQueryClient(filters.value.queryClientKey);
|
|
14
14
|
const isMutating = vueDemi.ref(queryClient.isMutating(filters));
|
|
15
15
|
const unsubscribe = queryClient.getMutationCache().subscribe(() => {
|
|
16
16
|
isMutating.value = queryClient.isMutating(filters);
|
|
17
17
|
});
|
|
18
|
-
vueDemi.watch(
|
|
19
|
-
filters.value = parseMutationFilterArgs(arg1, arg2);
|
|
18
|
+
vueDemi.watch(filters, () => {
|
|
20
19
|
isMutating.value = queryClient.isMutating(filters);
|
|
21
20
|
}, {
|
|
22
21
|
deep: true
|
|
@@ -26,21 +25,23 @@ function useIsMutating(arg1, arg2) {
|
|
|
26
25
|
});
|
|
27
26
|
return isMutating;
|
|
28
27
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
28
|
+
function parseFilterArgs(arg1, arg2 = {}) {
|
|
29
|
+
const plainArg1 = vueDemi.isRef(arg1) ? arg1.value : arg1;
|
|
30
|
+
const plainArg2 = vueDemi.isRef(arg2) ? arg2.value : arg2;
|
|
31
|
+
let options = plainArg1;
|
|
31
32
|
|
|
32
|
-
if (utils.isQueryKey(
|
|
33
|
-
options = { ...
|
|
34
|
-
mutationKey:
|
|
33
|
+
if (utils.isQueryKey(plainArg1)) {
|
|
34
|
+
options = { ...plainArg2,
|
|
35
|
+
mutationKey: plainArg1
|
|
35
36
|
};
|
|
36
37
|
} else {
|
|
37
38
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
38
|
-
options =
|
|
39
|
+
options = plainArg1 || {};
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
return utils.cloneDeepUnref(options);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
exports.
|
|
45
|
+
exports.parseFilterArgs = parseFilterArgs;
|
|
45
46
|
exports.useIsMutating = useIsMutating;
|
|
46
47
|
//# sourceMappingURL=useIsMutating.js.map
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"useIsMutating.js","sources":["../../src/useIsMutating.ts"],"sourcesContent":["import { computed, isRef, 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 { MaybeRef, MaybeRefDeep, WithQueryClientKey } from './types'\n\nexport type MutationFilters = MaybeRefDeep<WithQueryClientKey<MF>>\n\nexport function useIsMutating(filters?: MutationFilters): Ref<number>\nexport function useIsMutating(\n mutationKey?: MaybeRef<MutationKey>,\n filters?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number>\nexport function useIsMutating(\n arg1?: MaybeRef<MutationKey> | MutationFilters,\n arg2?: Omit<MutationFilters, 'mutationKey'>,\n): Ref<number> {\n const filters = computed(() => parseFilterArgs(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 filters,\n () => {\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 parseFilterArgs(\n arg1?: MaybeRef<MutationKey> | MutationFilters,\n arg2: MutationFilters = {},\n) {\n const plainArg1 = isRef(arg1) ? arg1.value : arg1\n const plainArg2 = isRef(arg2) ? arg2.value : arg2\n\n let options = plainArg1\n\n if (isQueryKey(plainArg1)) {\n options = { ...plainArg2, mutationKey: plainArg1 }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n options = plainArg1 || {}\n }\n\n return cloneDeepUnref(options) as WithQueryClientKey<MF>\n}\n"],"names":["useIsMutating","arg1","arg2","filters","computed","parseFilterArgs","queryClient","value","useQueryClient","queryClientKey","isMutating","ref","unsubscribe","getMutationCache","subscribe","watch","deep","onScopeDispose","plainArg1","isRef","plainArg2","options","is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nB,GAA2BL,IAA7C,CAAA;EAEA,IAAImB,OAAO,GAAGH,SAAd,CAAA;;AAEA,EAAA,IAAII,gBAAU,CAACJ,SAAD,CAAd,EAA2B;IACzBG,OAAO,GAAG,EAAE,GAAGD,SAAL;AAAgBG,MAAAA,WAAW,EAAEL,SAAAA;KAAvC,CAAA;AACD,GAFD,MAEO;AACL;IACAG,OAAO,GAAGH,SAAS,IAAI,EAAvB,CAAA;AACD,GAAA;;EAED,OAAOM,oBAAc,CAACH,OAAD,CAArB,CAAA;AACD;;;;;"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ref, watch, onScopeDispose } from 'vue-demi';
|
|
1
|
+
import { computed, ref, watch, onScopeDispose, isRef } from 'vue-demi';
|
|
2
2
|
import { useQueryClient } from './useQueryClient.mjs';
|
|
3
3
|
import { isQueryKey, cloneDeepUnref } from './utils.mjs';
|
|
4
4
|
|
|
5
5
|
function useIsMutating(arg1, arg2) {
|
|
6
6
|
var _filters$value$queryC;
|
|
7
7
|
|
|
8
|
-
const filters =
|
|
8
|
+
const filters = computed(() => parseFilterArgs(arg1, arg2));
|
|
9
9
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
10
10
|
const isMutating = ref(queryClient.isMutating(filters));
|
|
11
11
|
const unsubscribe = queryClient.getMutationCache().subscribe(() => {
|
|
12
12
|
isMutating.value = queryClient.isMutating(filters);
|
|
13
13
|
});
|
|
14
|
-
watch(
|
|
15
|
-
filters.value = parseMutationFilterArgs(arg1, arg2);
|
|
14
|
+
watch(filters, () => {
|
|
16
15
|
isMutating.value = queryClient.isMutating(filters);
|
|
17
16
|
}, {
|
|
18
17
|
deep: true
|
|
@@ -22,20 +21,22 @@ function useIsMutating(arg1, arg2) {
|
|
|
22
21
|
});
|
|
23
22
|
return isMutating;
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
24
|
+
function parseFilterArgs(arg1, arg2 = {}) {
|
|
25
|
+
const plainArg1 = isRef(arg1) ? arg1.value : arg1;
|
|
26
|
+
const plainArg2 = isRef(arg2) ? arg2.value : arg2;
|
|
27
|
+
let options = plainArg1;
|
|
27
28
|
|
|
28
|
-
if (isQueryKey(
|
|
29
|
-
options = { ...
|
|
30
|
-
mutationKey:
|
|
29
|
+
if (isQueryKey(plainArg1)) {
|
|
30
|
+
options = { ...plainArg2,
|
|
31
|
+
mutationKey: plainArg1
|
|
31
32
|
};
|
|
32
33
|
} else {
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
34
|
-
options =
|
|
35
|
+
options = plainArg1 || {};
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
return cloneDeepUnref(options);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
export {
|
|
41
|
+
export { parseFilterArgs, useIsMutating };
|
|
41
42
|
//# sourceMappingURL=useIsMutating.mjs.map
|