@tanstack/vue-query 5.0.0-alpha.5 → 5.0.0-alpha.7
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/devtools/devtools.esm.js +4 -3
- package/build/lib/devtools/devtools.esm.js.map +1 -1
- package/build/lib/devtools/devtools.js +4 -3
- package/build/lib/devtools/devtools.js.map +1 -1
- package/build/lib/devtools/devtools.mjs +0 -1
- package/build/lib/devtools/devtools.mjs.map +1 -1
- package/build/lib/devtools/utils.esm.js +0 -1
- package/build/lib/devtools/utils.esm.js.map +1 -1
- package/build/lib/devtools/utils.js +0 -1
- package/build/lib/devtools/utils.js.map +1 -1
- package/build/lib/devtools/utils.mjs +0 -1
- package/build/lib/devtools/utils.mjs.map +1 -1
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.esm.js +1 -1
- package/build/lib/index.js +3 -2
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +1 -1
- package/build/lib/queryClient.esm.js +1 -1
- package/build/lib/queryClient.esm.js.map +1 -1
- package/build/lib/queryClient.js +1 -1
- package/build/lib/queryClient.js.map +1 -1
- package/build/lib/useMutationState.d.ts +11 -0
- package/build/lib/useMutationState.esm.js +33 -0
- package/build/lib/useMutationState.esm.js.map +1 -0
- package/build/lib/useMutationState.js +36 -0
- package/build/lib/useMutationState.js.map +1 -0
- package/build/lib/useMutationState.mjs +33 -0
- package/build/lib/useMutationState.mjs.map +1 -0
- package/build/lib/useQueries.esm.js +2 -2
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js +2 -2
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs +2 -2
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQueryClient.esm.js +2 -1
- package/build/lib/useQueryClient.esm.js.map +1 -1
- package/build/lib/useQueryClient.js +2 -1
- package/build/lib/useQueryClient.js.map +1 -1
- package/build/lib/vueQueryPlugin.esm.js +0 -2
- package/build/lib/vueQueryPlugin.esm.js.map +1 -1
- package/build/lib/vueQueryPlugin.js +0 -2
- package/build/lib/vueQueryPlugin.js.map +1 -1
- package/build/lib/vueQueryPlugin.mjs +0 -2
- package/build/lib/vueQueryPlugin.mjs.map +1 -1
- package/build/umd/index.development.js +24 -17
- 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 +3 -3
- package/build/lib/useIsMutating.d.ts +0 -6
- package/build/lib/useIsMutating.esm.js +0 -24
- package/build/lib/useIsMutating.esm.js.map +0 -1
- package/build/lib/useIsMutating.js +0 -26
- package/build/lib/useIsMutating.js.map +0 -1
- package/build/lib/useIsMutating.mjs +0 -24
- package/build/lib/useIsMutating.mjs.map +0 -1
|
@@ -1494,6 +1494,7 @@
|
|
|
1494
1494
|
const queryFnContext = {
|
|
1495
1495
|
queryKey: context.queryKey,
|
|
1496
1496
|
pageParam: param,
|
|
1497
|
+
direction: previous ? 'backward' : 'forward',
|
|
1497
1498
|
meta: context.options.meta
|
|
1498
1499
|
};
|
|
1499
1500
|
addSignalProperty(queryFnContext);
|
|
@@ -3674,7 +3675,6 @@
|
|
|
3674
3675
|
};
|
|
3675
3676
|
}
|
|
3676
3677
|
|
|
3677
|
-
/* istanbul ignore file */
|
|
3678
3678
|
// eslint-disable-next-line no-shadow
|
|
3679
3679
|
var QueryState;
|
|
3680
3680
|
(function (QueryState) {
|
|
@@ -3752,7 +3752,6 @@
|
|
|
3752
3752
|
'Last Updated': dateSort
|
|
3753
3753
|
};
|
|
3754
3754
|
|
|
3755
|
-
/* istanbul ignore file */
|
|
3756
3755
|
const pluginId = 'vue-query';
|
|
3757
3756
|
const pluginName = 'Vue Query';
|
|
3758
3757
|
function setupDevtools(app, queryClient) {
|
|
@@ -3938,8 +3937,6 @@
|
|
|
3938
3937
|
originalUnmount();
|
|
3939
3938
|
};
|
|
3940
3939
|
}
|
|
3941
|
-
|
|
3942
|
-
/* istanbul ignore next */
|
|
3943
3940
|
if (vueDemi.isVue2) {
|
|
3944
3941
|
app.mixin({
|
|
3945
3942
|
beforeCreate() {
|
|
@@ -4059,14 +4056,14 @@
|
|
|
4059
4056
|
state.value.splice(0, result.length, ...result);
|
|
4060
4057
|
});
|
|
4061
4058
|
// Subscription would not fire for persisted results
|
|
4062
|
-
state.value
|
|
4059
|
+
state.value = observer.getOptimisticResult(defaultedQueries.value);
|
|
4063
4060
|
}
|
|
4064
4061
|
}, {
|
|
4065
4062
|
immediate: true
|
|
4066
4063
|
});
|
|
4067
4064
|
vueDemi.watch(defaultedQueries, () => {
|
|
4068
4065
|
observer.setQueries(defaultedQueries.value);
|
|
4069
|
-
state.value
|
|
4066
|
+
state.value = observer.getCurrentResult();
|
|
4070
4067
|
}, {
|
|
4071
4068
|
deep: true
|
|
4072
4069
|
});
|
|
@@ -4139,22 +4136,31 @@
|
|
|
4139
4136
|
return isFetching;
|
|
4140
4137
|
}
|
|
4141
4138
|
|
|
4142
|
-
function useIsMutating(
|
|
4143
|
-
const filters = vueDemi.computed(() => cloneDeepUnref(mutationFilters));
|
|
4139
|
+
function useIsMutating(filters = {}, queryClient) {
|
|
4144
4140
|
const client = queryClient || useQueryClient();
|
|
4145
|
-
const
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
});
|
|
4149
|
-
vueDemi.
|
|
4150
|
-
|
|
4151
|
-
},
|
|
4152
|
-
|
|
4141
|
+
const unreffedFilters = vueDemi.computed(() => ({
|
|
4142
|
+
...cloneDeepUnref(filters),
|
|
4143
|
+
status: 'pending'
|
|
4144
|
+
}));
|
|
4145
|
+
const length = vueDemi.computed(() => useMutationState({
|
|
4146
|
+
filters: unreffedFilters
|
|
4147
|
+
}, client).value.length);
|
|
4148
|
+
return length;
|
|
4149
|
+
}
|
|
4150
|
+
function getResult(mutationCache, options) {
|
|
4151
|
+
return mutationCache.findAll(options.filters).map(mutation => options.select ? options.select(mutation) : mutation.state);
|
|
4152
|
+
}
|
|
4153
|
+
function useMutationState(options = {}, queryClient) {
|
|
4154
|
+
const mutationCache = (queryClient || useQueryClient()).getMutationCache();
|
|
4155
|
+
const state = vueDemi.ref(getResult(mutationCache, options));
|
|
4156
|
+
const unsubscribe = mutationCache.subscribe(() => {
|
|
4157
|
+
const result = getResult(mutationCache, options);
|
|
4158
|
+
state.value = result;
|
|
4153
4159
|
});
|
|
4154
4160
|
vueDemi.onScopeDispose(() => {
|
|
4155
4161
|
unsubscribe();
|
|
4156
4162
|
});
|
|
4157
|
-
return
|
|
4163
|
+
return vueDemi.readonly(state);
|
|
4158
4164
|
}
|
|
4159
4165
|
|
|
4160
4166
|
exports.CancelledError = CancelledError;
|
|
@@ -4184,6 +4190,7 @@
|
|
|
4184
4190
|
exports.useIsFetching = useIsFetching;
|
|
4185
4191
|
exports.useIsMutating = useIsMutating;
|
|
4186
4192
|
exports.useMutation = useMutation;
|
|
4193
|
+
exports.useMutationState = useMutationState;
|
|
4187
4194
|
exports.useQueries = useQueries;
|
|
4188
4195
|
exports.useQuery = useQuery;
|
|
4189
4196
|
exports.useQueryClient = useQueryClient;
|