mobx 6.16.0 → 6.16.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # mobx
2
2
 
3
+ ## 6.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7fd93348e81f484c4ec2dcca8cde5fa6ed7412fe`](https://github.com/mobxjs/mobx/commit/7fd93348e81f484c4ec2dcca8cde5fa6ed7412fe) [#4661](https://github.com/mobxjs/mobx/pull/4661) Thanks [@js2me](https://github.com/js2me)! - Fix Stage 3 `@computed` overrides that delegate to a same-named parent getter via `super`.
8
+
9
+ - [`02afa5b6c33441737df81d344161a03bb9aea0c8`](https://github.com/mobxjs/mobx/commit/02afa5b6c33441737df81d344161a03bb9aea0c8) [#4666](https://github.com/mobxjs/mobx/pull/4666) Thanks [@kubk](https://github.com/kubk)! - Remove outdated Flow typechecker support artifacts from the package.
10
+
3
11
  ## 6.16.0
4
12
 
5
13
  ### Minor Changes
@@ -945,24 +945,44 @@ function decorate_20223_$3(get, context) {
945
945
  var ann = this;
946
946
  var key = context.name,
947
947
  addInitializer = context.addInitializer;
948
+ var computedValues;
948
949
  // Defer ComputedValue creation until first access — avoids allocating
949
950
  // ComputedValues for getters that are never read on a given instance.
950
951
  // The factory is materialised by ObservableObjectAdministration on demand.
952
+ function createComputedValue(target, adm) {
953
+ var options = _extends({}, ann.options_, {
954
+ get: get,
955
+ context: target
956
+ });
957
+ options.name || (options.name = adm.name_ + "." + key.toString() );
958
+ return new ComputedValue(options);
959
+ }
951
960
  addInitializer(function () {
952
961
  var _adm$lazyComputedKeys;
953
962
  var adm = asObservableObject(this)[$mobx];
954
963
  var target = this;
964
+ var observable = adm.values_.get(key);
965
+ if (observable instanceof ComputedValue && observable.derivation !== get) {
966
+ adm.values_["delete"](key);
967
+ }
955
968
  ((_adm$lazyComputedKeys = adm.lazyComputedKeys_) != null ? _adm$lazyComputedKeys : adm.lazyComputedKeys_ = new Map()).set(key, function () {
956
- var options = _extends({}, ann.options_, {
957
- get: get,
958
- context: target
959
- });
960
- options.name || (options.name = adm.name_ + "." + key.toString() );
961
- return new ComputedValue(options);
969
+ return createComputedValue(target, adm);
962
970
  });
963
971
  });
964
972
  return function () {
965
- return this[$mobx].getObservablePropValue_(key);
973
+ var adm = this[$mobx];
974
+ var observable = adm.values_.get(key);
975
+ if (observable instanceof ComputedValue && observable.derivation !== get) {
976
+ var _computedValues;
977
+ var computed = (_computedValues = computedValues) == null ? void 0 : _computedValues.get(this);
978
+ if (!computed) {
979
+ var _computedValues2;
980
+ computed = createComputedValue(this, adm);
981
+ ((_computedValues2 = computedValues) != null ? _computedValues2 : computedValues = new WeakMap()).set(this, computed);
982
+ }
983
+ return computed.get();
984
+ }
985
+ return adm.getObservablePropValue_(key);
966
986
  };
967
987
  }
968
988
  function assertComputedDescriptor(adm, _ref, key, _ref2) {