@tanstack/react-query 4.26.0 → 4.26.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.
|
@@ -1413,18 +1413,23 @@
|
|
|
1413
1413
|
class Mutation extends Removable {
|
|
1414
1414
|
constructor(config) {
|
|
1415
1415
|
super();
|
|
1416
|
-
this.
|
|
1417
|
-
...config.options
|
|
1418
|
-
};
|
|
1416
|
+
this.defaultOptions = config.defaultOptions;
|
|
1419
1417
|
this.mutationId = config.mutationId;
|
|
1420
1418
|
this.mutationCache = config.mutationCache;
|
|
1421
1419
|
this.logger = config.logger || defaultLogger;
|
|
1422
1420
|
this.observers = [];
|
|
1423
1421
|
this.state = config.state || getDefaultState();
|
|
1424
|
-
this.
|
|
1422
|
+
this.setOptions(config.options);
|
|
1425
1423
|
this.scheduleGc();
|
|
1426
1424
|
}
|
|
1427
1425
|
|
|
1426
|
+
setOptions(options) {
|
|
1427
|
+
this.options = { ...this.defaultOptions,
|
|
1428
|
+
...options
|
|
1429
|
+
};
|
|
1430
|
+
this.updateCacheTime(this.options.cacheTime);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1428
1433
|
get meta() {
|
|
1429
1434
|
return this.options.meta;
|
|
1430
1435
|
}
|
|
@@ -2998,6 +3003,8 @@
|
|
|
2998
3003
|
}
|
|
2999
3004
|
|
|
3000
3005
|
setOptions(options) {
|
|
3006
|
+
var _this$currentMutation;
|
|
3007
|
+
|
|
3001
3008
|
const prevOptions = this.options;
|
|
3002
3009
|
this.options = this.client.defaultMutationOptions(options);
|
|
3003
3010
|
|
|
@@ -3008,13 +3015,15 @@
|
|
|
3008
3015
|
observer: this
|
|
3009
3016
|
});
|
|
3010
3017
|
}
|
|
3018
|
+
|
|
3019
|
+
(_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.setOptions(this.options);
|
|
3011
3020
|
}
|
|
3012
3021
|
|
|
3013
3022
|
onUnsubscribe() {
|
|
3014
3023
|
if (!this.listeners.length) {
|
|
3015
|
-
var _this$
|
|
3024
|
+
var _this$currentMutation2;
|
|
3016
3025
|
|
|
3017
|
-
(_this$
|
|
3026
|
+
(_this$currentMutation2 = this.currentMutation) == null ? void 0 : _this$currentMutation2.removeObserver(this);
|
|
3018
3027
|
}
|
|
3019
3028
|
}
|
|
3020
3029
|
|