@tanstack/vue-query 4.16.1 → 4.17.1
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/index.d.ts +2 -3
- package/build/lib/index.js +4 -4
- 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/useInfiniteQuery.d.ts +1 -1
- package/build/lib/useInfiniteQuery.esm.js.map +1 -1
- package/build/lib/useInfiniteQuery.js.map +1 -1
- package/build/lib/useInfiniteQuery.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 +28 -18
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +27 -17
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +28 -18
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQuery.d.ts +2 -3
- package/build/lib/useQuery.esm.js.map +1 -1
- package/build/lib/useQuery.js.map +1 -1
- package/build/lib/useQuery.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 +132 -93
- 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 +8 -4
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
function timeUntilStale(updatedAt, staleTime) {
|
|
55
55
|
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
56
56
|
}
|
|
57
|
-
function parseQueryArgs(arg1, arg2, arg3) {
|
|
57
|
+
function parseQueryArgs$1(arg1, arg2, arg3) {
|
|
58
58
|
if (!isQueryKey$1(arg1)) {
|
|
59
59
|
return arg1;
|
|
60
60
|
}
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
return { ...arg1
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function parseFilterArgs$
|
|
96
|
+
function parseFilterArgs$2(arg1, arg2, arg3) {
|
|
97
97
|
return isQueryKey$1(arg1) ? [{ ...arg2,
|
|
98
98
|
queryKey: arg1
|
|
99
99
|
}, arg3] : [arg1 || {}, arg2];
|
|
100
100
|
}
|
|
101
|
-
function parseMutationFilterArgs
|
|
101
|
+
function parseMutationFilterArgs(arg1, arg2, arg3) {
|
|
102
102
|
return isQueryKey$1(arg1) ? [{ ...arg2,
|
|
103
103
|
mutationKey: arg1
|
|
104
104
|
}, arg3] : [arg1 || {}, arg2];
|
|
@@ -1329,7 +1329,7 @@
|
|
|
1329
1329
|
}
|
|
1330
1330
|
|
|
1331
1331
|
find(arg1, arg2) {
|
|
1332
|
-
const [filters] = parseFilterArgs$
|
|
1332
|
+
const [filters] = parseFilterArgs$2(arg1, arg2);
|
|
1333
1333
|
|
|
1334
1334
|
if (typeof filters.exact === 'undefined') {
|
|
1335
1335
|
filters.exact = true;
|
|
@@ -1339,7 +1339,7 @@
|
|
|
1339
1339
|
}
|
|
1340
1340
|
|
|
1341
1341
|
findAll(arg1, arg2) {
|
|
1342
|
-
const [filters] = parseFilterArgs$
|
|
1342
|
+
const [filters] = parseFilterArgs$2(arg1, arg2);
|
|
1343
1343
|
return Object.keys(filters).length > 0 ? this.queries.filter(query => matchQuery(filters, query)) : this.queries;
|
|
1344
1344
|
}
|
|
1345
1345
|
|
|
@@ -1872,7 +1872,7 @@
|
|
|
1872
1872
|
}
|
|
1873
1873
|
|
|
1874
1874
|
isFetching(arg1, arg2) {
|
|
1875
|
-
const [filters] = parseFilterArgs$
|
|
1875
|
+
const [filters] = parseFilterArgs$2(arg1, arg2);
|
|
1876
1876
|
filters.fetchStatus = 'fetching';
|
|
1877
1877
|
return this.queryCache.findAll(filters).length;
|
|
1878
1878
|
}
|
|
@@ -1908,7 +1908,7 @@
|
|
|
1908
1908
|
return undefined;
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
|
-
const parsedOptions = parseQueryArgs(queryKey);
|
|
1911
|
+
const parsedOptions = parseQueryArgs$1(queryKey);
|
|
1912
1912
|
const defaultedOptions = this.defaultQueryOptions(parsedOptions);
|
|
1913
1913
|
return this.queryCache.build(this, defaultedOptions).setData(data, { ...options,
|
|
1914
1914
|
manual: true
|
|
@@ -1928,7 +1928,7 @@
|
|
|
1928
1928
|
}
|
|
1929
1929
|
|
|
1930
1930
|
removeQueries(arg1, arg2) {
|
|
1931
|
-
const [filters] = parseFilterArgs$
|
|
1931
|
+
const [filters] = parseFilterArgs$2(arg1, arg2);
|
|
1932
1932
|
const queryCache = this.queryCache;
|
|
1933
1933
|
notifyManager.batch(() => {
|
|
1934
1934
|
queryCache.findAll(filters).forEach(query => {
|
|
@@ -1938,7 +1938,7 @@
|
|
|
1938
1938
|
}
|
|
1939
1939
|
|
|
1940
1940
|
resetQueries(arg1, arg2, arg3) {
|
|
1941
|
-
const [filters, options] = parseFilterArgs$
|
|
1941
|
+
const [filters, options] = parseFilterArgs$2(arg1, arg2, arg3);
|
|
1942
1942
|
const queryCache = this.queryCache;
|
|
1943
1943
|
const refetchFilters = {
|
|
1944
1944
|
type: 'active',
|
|
@@ -1953,7 +1953,7 @@
|
|
|
1953
1953
|
}
|
|
1954
1954
|
|
|
1955
1955
|
cancelQueries(arg1, arg2, arg3) {
|
|
1956
|
-
const [filters, cancelOptions = {}] = parseFilterArgs$
|
|
1956
|
+
const [filters, cancelOptions = {}] = parseFilterArgs$2(arg1, arg2, arg3);
|
|
1957
1957
|
|
|
1958
1958
|
if (typeof cancelOptions.revert === 'undefined') {
|
|
1959
1959
|
cancelOptions.revert = true;
|
|
@@ -1964,7 +1964,7 @@
|
|
|
1964
1964
|
}
|
|
1965
1965
|
|
|
1966
1966
|
invalidateQueries(arg1, arg2, arg3) {
|
|
1967
|
-
const [filters, options] = parseFilterArgs$
|
|
1967
|
+
const [filters, options] = parseFilterArgs$2(arg1, arg2, arg3);
|
|
1968
1968
|
return notifyManager.batch(() => {
|
|
1969
1969
|
var _ref, _filters$refetchType;
|
|
1970
1970
|
|
|
@@ -1984,7 +1984,7 @@
|
|
|
1984
1984
|
}
|
|
1985
1985
|
|
|
1986
1986
|
refetchQueries(arg1, arg2, arg3) {
|
|
1987
|
-
const [filters, options] = parseFilterArgs$
|
|
1987
|
+
const [filters, options] = parseFilterArgs$2(arg1, arg2, arg3);
|
|
1988
1988
|
const promises = notifyManager.batch(() => this.queryCache.findAll(filters).filter(query => !query.isDisabled()).map(query => {
|
|
1989
1989
|
var _options$cancelRefetc;
|
|
1990
1990
|
|
|
@@ -2005,7 +2005,7 @@
|
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
2007
|
fetchQuery(arg1, arg2, arg3) {
|
|
2008
|
-
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
2008
|
+
const parsedOptions = parseQueryArgs$1(arg1, arg2, arg3);
|
|
2009
2009
|
const defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652
|
|
2010
2010
|
|
|
2011
2011
|
if (typeof defaultedOptions.retry === 'undefined') {
|
|
@@ -2021,7 +2021,7 @@
|
|
|
2021
2021
|
}
|
|
2022
2022
|
|
|
2023
2023
|
fetchInfiniteQuery(arg1, arg2, arg3) {
|
|
2024
|
-
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
2024
|
+
const parsedOptions = parseQueryArgs$1(arg1, arg2, arg3);
|
|
2025
2025
|
parsedOptions.behavior = infiniteQueryBehavior();
|
|
2026
2026
|
return this.fetchQuery(parsedOptions);
|
|
2027
2027
|
}
|
|
@@ -3245,6 +3245,7 @@
|
|
|
3245
3245
|
mutationCache: unreffedConfig.mutationCache || new MutationCache()
|
|
3246
3246
|
};
|
|
3247
3247
|
super(vueQueryConfig);
|
|
3248
|
+
this.isRestoring = vueDemi.ref(false);
|
|
3248
3249
|
}
|
|
3249
3250
|
|
|
3250
3251
|
isFetching(arg1, arg2) {
|
|
@@ -4405,7 +4406,7 @@
|
|
|
4405
4406
|
id: pluginId,
|
|
4406
4407
|
label: pluginName,
|
|
4407
4408
|
packageName: 'vue-query',
|
|
4408
|
-
homepage: 'https://
|
|
4409
|
+
homepage: 'https://tanstack.com/query/v4',
|
|
4409
4410
|
logo: 'https://vue-query.vercel.app/vue-query.svg',
|
|
4410
4411
|
app,
|
|
4411
4412
|
settings: {
|
|
@@ -4576,12 +4577,25 @@
|
|
|
4576
4577
|
|
|
4577
4578
|
client.mount();
|
|
4578
4579
|
|
|
4580
|
+
let persisterUnmount = () => {// noop
|
|
4581
|
+
};
|
|
4582
|
+
|
|
4583
|
+
if (options.clientPersister) {
|
|
4584
|
+
client.isRestoring.value = true;
|
|
4585
|
+
const [unmount, promise] = options.clientPersister(client);
|
|
4586
|
+
persisterUnmount = unmount;
|
|
4587
|
+
promise.then(() => {
|
|
4588
|
+
client.isRestoring.value = false;
|
|
4589
|
+
});
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4579
4592
|
if (options.contextSharing) {
|
|
4580
4593
|
client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
4581
4594
|
}
|
|
4582
4595
|
|
|
4583
4596
|
const cleanup = () => {
|
|
4584
4597
|
client.unmount();
|
|
4598
|
+
persisterUnmount();
|
|
4585
4599
|
};
|
|
4586
4600
|
|
|
4587
4601
|
if (app.onUnmount) {
|
|
@@ -4630,43 +4644,61 @@
|
|
|
4630
4644
|
};
|
|
4631
4645
|
|
|
4632
4646
|
function useBaseQuery(Observer, arg1, arg2 = {}, arg3 = {}) {
|
|
4633
|
-
var _options$
|
|
4647
|
+
var _options$value$queryC;
|
|
4634
4648
|
|
|
4635
|
-
const options =
|
|
4636
|
-
const queryClient = (_options$
|
|
4637
|
-
const defaultedOptions =
|
|
4638
|
-
|
|
4649
|
+
const options = vueDemi.computed(() => parseQueryArgs(arg1, arg2, arg3));
|
|
4650
|
+
const queryClient = (_options$value$queryC = options.value.queryClient) != null ? _options$value$queryC : useQueryClient(options.value.queryClientKey);
|
|
4651
|
+
const defaultedOptions = vueDemi.computed(() => {
|
|
4652
|
+
const defaulted = queryClient.defaultQueryOptions(options.value);
|
|
4653
|
+
defaulted._optimisticResults = queryClient.isRestoring.value ? 'isRestoring' : 'optimistic';
|
|
4654
|
+
return defaulted;
|
|
4655
|
+
});
|
|
4656
|
+
const observer = new Observer(queryClient, defaultedOptions.value);
|
|
4639
4657
|
const state = vueDemi.reactive(observer.getCurrentResult());
|
|
4640
|
-
const unsubscribe =
|
|
4641
|
-
|
|
4658
|
+
const unsubscribe = vueDemi.ref(() => {// noop
|
|
4659
|
+
});
|
|
4660
|
+
vueDemi.watch(queryClient.isRestoring, isRestoring => {
|
|
4661
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
4662
|
+
if (!isRestoring) {
|
|
4663
|
+
unsubscribe.value();
|
|
4664
|
+
unsubscribe.value = observer.subscribe(result => {
|
|
4665
|
+
updateState(state, result);
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
4668
|
+
}, {
|
|
4669
|
+
immediate: true
|
|
4642
4670
|
});
|
|
4643
|
-
vueDemi.watch(
|
|
4644
|
-
observer.setOptions(
|
|
4671
|
+
vueDemi.watch(defaultedOptions, () => {
|
|
4672
|
+
observer.setOptions(defaultedOptions.value);
|
|
4673
|
+
updateState(state, observer.getCurrentResult());
|
|
4645
4674
|
}, {
|
|
4646
4675
|
deep: true
|
|
4647
4676
|
});
|
|
4648
4677
|
vueDemi.onScopeDispose(() => {
|
|
4649
|
-
unsubscribe();
|
|
4678
|
+
unsubscribe.value();
|
|
4650
4679
|
});
|
|
4651
4680
|
|
|
4652
4681
|
const suspense = () => {
|
|
4653
4682
|
return new Promise(resolve => {
|
|
4654
|
-
|
|
4655
|
-
|
|
4683
|
+
let stopWatch = () => {//noop
|
|
4684
|
+
};
|
|
4656
4685
|
|
|
4657
|
-
|
|
4658
|
-
|
|
4686
|
+
const run = () => {
|
|
4687
|
+
if (defaultedOptions.value.enabled !== false) {
|
|
4688
|
+
const optimisticResult = observer.getOptimisticResult(defaultedOptions.value);
|
|
4659
4689
|
|
|
4660
4690
|
if (optimisticResult.isStale) {
|
|
4661
|
-
|
|
4691
|
+
stopWatch();
|
|
4692
|
+
resolve(observer.fetchOptimistic(defaultedOptions.value));
|
|
4662
4693
|
} else {
|
|
4694
|
+
stopWatch();
|
|
4663
4695
|
resolve(optimisticResult);
|
|
4664
4696
|
}
|
|
4665
4697
|
}
|
|
4666
4698
|
};
|
|
4667
4699
|
|
|
4668
4700
|
run();
|
|
4669
|
-
vueDemi.watch(
|
|
4701
|
+
stopWatch = vueDemi.watch(defaultedOptions, run, {
|
|
4670
4702
|
deep: true
|
|
4671
4703
|
});
|
|
4672
4704
|
});
|
|
@@ -4675,32 +4707,27 @@
|
|
|
4675
4707
|
return { ...vueDemi.toRefs(vueDemi.readonly(state)),
|
|
4676
4708
|
suspense
|
|
4677
4709
|
};
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
let mergedOptions;
|
|
4685
|
-
|
|
4686
|
-
if (!isQueryKey(arg1)) {
|
|
4687
|
-
// `useQuery(optionsObj)`
|
|
4688
|
-
mergedOptions = arg1;
|
|
4689
|
-
} else if (typeof arg2 === 'function') {
|
|
4690
|
-
// `useQuery(queryKey, queryFn, optionsObj?)`
|
|
4691
|
-
mergedOptions = { ...arg3,
|
|
4692
|
-
queryKey: arg1,
|
|
4693
|
-
queryFn: arg2
|
|
4694
|
-
};
|
|
4695
|
-
} else {
|
|
4696
|
-
// `useQuery(queryKey, optionsObj?)`
|
|
4697
|
-
mergedOptions = { ...arg2,
|
|
4698
|
-
queryKey: arg1
|
|
4699
|
-
};
|
|
4700
|
-
}
|
|
4710
|
+
}
|
|
4711
|
+
function parseQueryArgs(arg1, arg2 = {}, arg3 = {}) {
|
|
4712
|
+
const plainArg1 = vueDemi.isRef(arg1) ? arg1.value : arg1;
|
|
4713
|
+
const plainArg2 = vueDemi.isRef(arg2) ? arg2.value : arg2;
|
|
4714
|
+
const plainArg3 = vueDemi.isRef(arg3) ? arg3.value : arg3;
|
|
4715
|
+
let options = plainArg1;
|
|
4701
4716
|
|
|
4702
|
-
|
|
4717
|
+
if (!isQueryKey(plainArg1)) {
|
|
4718
|
+
options = plainArg1;
|
|
4719
|
+
} else if (typeof plainArg2 === 'function') {
|
|
4720
|
+
options = { ...plainArg3,
|
|
4721
|
+
queryKey: plainArg1,
|
|
4722
|
+
queryFn: plainArg2
|
|
4723
|
+
};
|
|
4724
|
+
} else {
|
|
4725
|
+
options = { ...plainArg2,
|
|
4726
|
+
queryKey: plainArg1
|
|
4727
|
+
};
|
|
4703
4728
|
}
|
|
4729
|
+
|
|
4730
|
+
return cloneDeepUnref(options);
|
|
4704
4731
|
}
|
|
4705
4732
|
|
|
4706
4733
|
function useQuery(arg1, arg2, arg3) {
|
|
@@ -4712,34 +4739,44 @@
|
|
|
4712
4739
|
}
|
|
4713
4740
|
|
|
4714
4741
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4715
|
-
|
|
4716
4742
|
function useQueries({
|
|
4717
4743
|
queries
|
|
4718
4744
|
}) {
|
|
4719
|
-
var _unreffedQueries
|
|
4745
|
+
var _unreffedQueries$valu, _unreffedQueries$valu2;
|
|
4720
4746
|
|
|
4721
|
-
const unreffedQueries = cloneDeepUnref(queries);
|
|
4722
|
-
const queryClientKey = (_unreffedQueries$ = unreffedQueries[0]) == null ? void 0 : _unreffedQueries
|
|
4723
|
-
const optionsQueryClient = (_unreffedQueries$
|
|
4747
|
+
const unreffedQueries = vueDemi.computed(() => cloneDeepUnref(queries));
|
|
4748
|
+
const queryClientKey = (_unreffedQueries$valu = unreffedQueries.value[0]) == null ? void 0 : _unreffedQueries$valu.queryClientKey;
|
|
4749
|
+
const optionsQueryClient = (_unreffedQueries$valu2 = unreffedQueries.value[0]) == null ? void 0 : _unreffedQueries$valu2.queryClient;
|
|
4724
4750
|
const queryClient = optionsQueryClient != null ? optionsQueryClient : useQueryClient(queryClientKey);
|
|
4725
|
-
const defaultedQueries = unreffedQueries.map(options => {
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4751
|
+
const defaultedQueries = vueDemi.computed(() => unreffedQueries.value.map(options => {
|
|
4752
|
+
const defaulted = queryClient.defaultQueryOptions(options);
|
|
4753
|
+
defaulted._optimisticResults = queryClient.isRestoring.value ? 'isRestoring' : 'optimistic';
|
|
4754
|
+
return defaulted;
|
|
4755
|
+
}));
|
|
4756
|
+
const observer = new QueriesObserver(queryClient, defaultedQueries.value);
|
|
4729
4757
|
const state = vueDemi.reactive(observer.getCurrentResult());
|
|
4730
|
-
const unsubscribe =
|
|
4731
|
-
state.splice(0, state.length, ...result);
|
|
4758
|
+
const unsubscribe = vueDemi.ref(() => {// noop
|
|
4732
4759
|
});
|
|
4733
|
-
vueDemi.watch(
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4760
|
+
vueDemi.watch(queryClient.isRestoring, isRestoring => {
|
|
4761
|
+
if (!isRestoring) {
|
|
4762
|
+
unsubscribe.value();
|
|
4763
|
+
unsubscribe.value = observer.subscribe(result => {
|
|
4764
|
+
state.splice(0, result.length, ...result);
|
|
4765
|
+
}); // Subscription would not fire for persisted results
|
|
4766
|
+
|
|
4767
|
+
state.splice(0, state.length, ...observer.getOptimisticResult(defaultedQueries.value));
|
|
4768
|
+
}
|
|
4769
|
+
}, {
|
|
4770
|
+
immediate: true
|
|
4771
|
+
});
|
|
4772
|
+
vueDemi.watch(unreffedQueries, () => {
|
|
4773
|
+
observer.setQueries(defaultedQueries.value);
|
|
4774
|
+
state.splice(0, state.length, ...observer.getCurrentResult());
|
|
4738
4775
|
}, {
|
|
4739
4776
|
deep: true
|
|
4740
4777
|
});
|
|
4741
4778
|
vueDemi.onScopeDispose(() => {
|
|
4742
|
-
unsubscribe();
|
|
4779
|
+
unsubscribe.value();
|
|
4743
4780
|
});
|
|
4744
4781
|
return vueDemi.readonly(state);
|
|
4745
4782
|
}
|
|
@@ -4818,14 +4855,13 @@
|
|
|
4818
4855
|
function useIsFetching(arg1, arg2) {
|
|
4819
4856
|
var _filters$value$queryC;
|
|
4820
4857
|
|
|
4821
|
-
const filters = vueDemi.
|
|
4858
|
+
const filters = vueDemi.computed(() => parseFilterArgs$1(arg1, arg2));
|
|
4822
4859
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
4823
4860
|
const isFetching = vueDemi.ref(queryClient.isFetching(filters));
|
|
4824
4861
|
const unsubscribe = queryClient.getQueryCache().subscribe(() => {
|
|
4825
4862
|
isFetching.value = queryClient.isFetching(filters);
|
|
4826
4863
|
});
|
|
4827
|
-
vueDemi.watch(
|
|
4828
|
-
filters.value = parseFilterArgs(arg1, arg2);
|
|
4864
|
+
vueDemi.watch(filters, () => {
|
|
4829
4865
|
isFetching.value = queryClient.isFetching(filters);
|
|
4830
4866
|
}, {
|
|
4831
4867
|
deep: true
|
|
@@ -4835,16 +4871,18 @@
|
|
|
4835
4871
|
});
|
|
4836
4872
|
return isFetching;
|
|
4837
4873
|
}
|
|
4838
|
-
function parseFilterArgs(arg1, arg2 = {}) {
|
|
4839
|
-
|
|
4874
|
+
function parseFilterArgs$1(arg1, arg2 = {}) {
|
|
4875
|
+
const plainArg1 = vueDemi.isRef(arg1) ? arg1.value : arg1;
|
|
4876
|
+
const plainArg2 = vueDemi.isRef(arg2) ? arg2.value : arg2;
|
|
4877
|
+
let options = plainArg1;
|
|
4840
4878
|
|
|
4841
|
-
if (isQueryKey(
|
|
4842
|
-
options = { ...
|
|
4843
|
-
queryKey:
|
|
4879
|
+
if (isQueryKey(plainArg1)) {
|
|
4880
|
+
options = { ...plainArg2,
|
|
4881
|
+
queryKey: plainArg1
|
|
4844
4882
|
};
|
|
4845
4883
|
} else {
|
|
4846
4884
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
4847
|
-
options =
|
|
4885
|
+
options = plainArg1 || {};
|
|
4848
4886
|
}
|
|
4849
4887
|
|
|
4850
4888
|
return cloneDeepUnref(options);
|
|
@@ -4853,14 +4891,13 @@
|
|
|
4853
4891
|
function useIsMutating(arg1, arg2) {
|
|
4854
4892
|
var _filters$value$queryC;
|
|
4855
4893
|
|
|
4856
|
-
const filters = vueDemi.
|
|
4894
|
+
const filters = vueDemi.computed(() => parseFilterArgs(arg1, arg2));
|
|
4857
4895
|
const queryClient = (_filters$value$queryC = filters.value.queryClient) != null ? _filters$value$queryC : useQueryClient(filters.value.queryClientKey);
|
|
4858
4896
|
const isMutating = vueDemi.ref(queryClient.isMutating(filters));
|
|
4859
4897
|
const unsubscribe = queryClient.getMutationCache().subscribe(() => {
|
|
4860
4898
|
isMutating.value = queryClient.isMutating(filters);
|
|
4861
4899
|
});
|
|
4862
|
-
vueDemi.watch(
|
|
4863
|
-
filters.value = parseMutationFilterArgs(arg1, arg2);
|
|
4900
|
+
vueDemi.watch(filters, () => {
|
|
4864
4901
|
isMutating.value = queryClient.isMutating(filters);
|
|
4865
4902
|
}, {
|
|
4866
4903
|
deep: true
|
|
@@ -4870,16 +4907,18 @@
|
|
|
4870
4907
|
});
|
|
4871
4908
|
return isMutating;
|
|
4872
4909
|
}
|
|
4873
|
-
function
|
|
4874
|
-
|
|
4910
|
+
function parseFilterArgs(arg1, arg2 = {}) {
|
|
4911
|
+
const plainArg1 = vueDemi.isRef(arg1) ? arg1.value : arg1;
|
|
4912
|
+
const plainArg2 = vueDemi.isRef(arg2) ? arg2.value : arg2;
|
|
4913
|
+
let options = plainArg1;
|
|
4875
4914
|
|
|
4876
|
-
if (isQueryKey(
|
|
4877
|
-
options = { ...
|
|
4878
|
-
mutationKey:
|
|
4915
|
+
if (isQueryKey(plainArg1)) {
|
|
4916
|
+
options = { ...plainArg2,
|
|
4917
|
+
mutationKey: plainArg1
|
|
4879
4918
|
};
|
|
4880
4919
|
} else {
|
|
4881
4920
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
4882
|
-
options =
|
|
4921
|
+
options = plainArg1 || {};
|
|
4883
4922
|
}
|
|
4884
4923
|
|
|
4885
4924
|
return cloneDeepUnref(options);
|
|
@@ -4904,10 +4943,10 @@
|
|
|
4904
4943
|
exports.isServer = isServer;
|
|
4905
4944
|
exports.notifyManager = notifyManager;
|
|
4906
4945
|
exports.onlineManager = onlineManager;
|
|
4907
|
-
exports.parseFilterArgs = parseFilterArgs$
|
|
4946
|
+
exports.parseFilterArgs = parseFilterArgs$2;
|
|
4908
4947
|
exports.parseMutationArgs = parseMutationArgs$1;
|
|
4909
|
-
exports.parseMutationFilterArgs = parseMutationFilterArgs
|
|
4910
|
-
exports.parseQueryArgs = parseQueryArgs;
|
|
4948
|
+
exports.parseMutationFilterArgs = parseMutationFilterArgs;
|
|
4949
|
+
exports.parseQueryArgs = parseQueryArgs$1;
|
|
4911
4950
|
exports.replaceEqualDeep = replaceEqualDeep;
|
|
4912
4951
|
exports.useInfiniteQuery = useInfiniteQuery;
|
|
4913
4952
|
exports.useIsFetching = useIsFetching;
|