@tanstack/vue-query 4.26.0 → 4.27.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.
|
@@ -1389,18 +1389,23 @@
|
|
|
1389
1389
|
class Mutation extends Removable {
|
|
1390
1390
|
constructor(config) {
|
|
1391
1391
|
super();
|
|
1392
|
-
this.
|
|
1393
|
-
...config.options
|
|
1394
|
-
};
|
|
1392
|
+
this.defaultOptions = config.defaultOptions;
|
|
1395
1393
|
this.mutationId = config.mutationId;
|
|
1396
1394
|
this.mutationCache = config.mutationCache;
|
|
1397
1395
|
this.logger = config.logger || defaultLogger;
|
|
1398
1396
|
this.observers = [];
|
|
1399
1397
|
this.state = config.state || getDefaultState();
|
|
1400
|
-
this.
|
|
1398
|
+
this.setOptions(config.options);
|
|
1401
1399
|
this.scheduleGc();
|
|
1402
1400
|
}
|
|
1403
1401
|
|
|
1402
|
+
setOptions(options) {
|
|
1403
|
+
this.options = { ...this.defaultOptions,
|
|
1404
|
+
...options
|
|
1405
|
+
};
|
|
1406
|
+
this.updateCacheTime(this.options.cacheTime);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1404
1409
|
get meta() {
|
|
1405
1410
|
return this.options.meta;
|
|
1406
1411
|
}
|
|
@@ -2974,6 +2979,8 @@
|
|
|
2974
2979
|
}
|
|
2975
2980
|
|
|
2976
2981
|
setOptions(options) {
|
|
2982
|
+
var _this$currentMutation;
|
|
2983
|
+
|
|
2977
2984
|
const prevOptions = this.options;
|
|
2978
2985
|
this.options = this.client.defaultMutationOptions(options);
|
|
2979
2986
|
|
|
@@ -2984,13 +2991,15 @@
|
|
|
2984
2991
|
observer: this
|
|
2985
2992
|
});
|
|
2986
2993
|
}
|
|
2994
|
+
|
|
2995
|
+
(_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.setOptions(this.options);
|
|
2987
2996
|
}
|
|
2988
2997
|
|
|
2989
2998
|
onUnsubscribe() {
|
|
2990
2999
|
if (!this.listeners.length) {
|
|
2991
|
-
var _this$
|
|
3000
|
+
var _this$currentMutation2;
|
|
2992
3001
|
|
|
2993
|
-
(_this$
|
|
3002
|
+
(_this$currentMutation2 = this.currentMutation) == null ? void 0 : _this$currentMutation2.removeObserver(this);
|
|
2994
3003
|
}
|
|
2995
3004
|
}
|
|
2996
3005
|
|