mobx 6.3.12 → 6.3.13

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/dist/mobx.esm.js CHANGED
@@ -733,7 +733,7 @@ function make_$2(adm, key, descriptor, source) {
733
733
  // bound - must annotate protos to support super.flow()
734
734
 
735
735
 
736
- if ((_this$options_ = this.options_) != null && _this$options_.bound && !isFlow(adm.target_[key])) {
736
+ if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
737
737
  if (this.extend_(adm, key, descriptor, false) === null) return 0
738
738
  /* Cancel */
739
739
  ;
@@ -777,16 +777,23 @@ safeDescriptors) {
777
777
  }
778
778
 
779
779
  assertFlowDescriptor(adm, annotation, key, descriptor);
780
- var value = descriptor.value;
780
+ var value = descriptor.value; // In case of flow.bound, the descriptor can be from already annotated prototype
781
+
782
+ if (!isFlow(value)) {
783
+ value = flow(value);
784
+ }
781
785
 
782
786
  if (bound) {
783
787
  var _adm$proxy_;
784
788
 
785
- value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);
789
+ // We do not keep original function around, so we bind the existing flow
790
+ value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_); // This is normally set by `flow`, but `bind` returns new function...
791
+
792
+ value.isMobXFlow = true;
786
793
  }
787
794
 
788
795
  return {
789
- value: flow(value),
796
+ value: value,
790
797
  // Non-configurable for classes
791
798
  // prevents accidental field redefinition in subclass
792
799
  configurable: safeDescriptors ? adm.isPlainObject_ : true,