mobx 6.10.1 → 6.10.2

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
@@ -459,17 +459,15 @@ var Atom = /*#__PURE__*/function () {
459
459
  * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
460
460
  */;
461
461
  _proto.reportChanged = function reportChanged() {
462
- if (globalState.inBatch && this.batchId_ === globalState.batchId) {
463
- // Called from the same batch this atom was created in.
464
- return;
462
+ if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
463
+ // We could update state version only at the end of batch,
464
+ // but we would still have to switch some global flag here to signal a change.
465
+ globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
466
+ // Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
467
+ this.batchId_ = NaN;
465
468
  }
466
- // Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
467
- this.batchId_ = NaN;
468
469
  startBatch();
469
470
  propagateChanged(this);
470
- // We could update state version only at the end of batch,
471
- // but we would still have to switch some global flag here to signal a change.
472
- globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
473
471
  endBatch();
474
472
  };
475
473
  _proto.toString = function toString() {