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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # mobx
2
2
 
3
+ ## 6.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c8d9374d`](https://github.com/mobxjs/mobx/commit/c8d9374d4f3b05cfec0d690e0eb3ada4f619ff0b) [#3748](https://github.com/mobxjs/mobx/pull/3748) Thanks [@mweststrate](https://github.com/mweststrate)! - Fixed: #3747, computed values becoming stale if the underlying observable was created and updated outside a reactive context
8
+
3
9
  ## 6.10.1
4
10
 
5
11
  ### Patch Changes
@@ -462,17 +462,15 @@ var Atom = /*#__PURE__*/function () {
462
462
  * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
463
463
  */;
464
464
  _proto.reportChanged = function reportChanged() {
465
- if (globalState.inBatch && this.batchId_ === globalState.batchId) {
466
- // Called from the same batch this atom was created in.
467
- return;
465
+ if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
466
+ // We could update state version only at the end of batch,
467
+ // but we would still have to switch some global flag here to signal a change.
468
+ globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
469
+ // Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
470
+ this.batchId_ = NaN;
468
471
  }
469
- // Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
470
- this.batchId_ = NaN;
471
472
  startBatch();
472
473
  propagateChanged(this);
473
- // We could update state version only at the end of batch,
474
- // but we would still have to switch some global flag here to signal a change.
475
- globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
476
474
  endBatch();
477
475
  };
478
476
  _proto.toString = function toString() {