mobx 6.8.0 → 6.9.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,17 @@
1
1
  # mobx
2
2
 
3
+ ## 6.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4792303e`](https://github.com/mobxjs/mobx/commit/4792303ec9119c1ba54134fff7e845d21a1d9337) [#3709](https://github.com/mobxjs/mobx/pull/3709) Thanks [@kubk](https://github.com/kubk)! - Make trace() noop in production build
8
+
9
+ ## 6.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54) [#3590](https://github.com/mobxjs/mobx/pull/3590) Thanks [@urugator](https://github.com/urugator)! - Better support for React 18: Mobx now keeps track of a global state version, which updates with each mutation.
14
+
3
15
  ## 6.8.0
4
16
 
5
17
  ### Minor Changes
@@ -101,6 +101,10 @@ export declare class MobXGlobals {
101
101
  * configurable: true
102
102
  */
103
103
  safeDescriptors: boolean;
104
+ /**
105
+ * Changes with each state update, used by useSyncExternalStore
106
+ */
107
+ stateVersion: number;
104
108
  }
105
109
  export declare let globalState: MobXGlobals;
106
110
  export declare function isolateGlobalState(): void;
@@ -462,6 +462,9 @@ var Atom = /*#__PURE__*/function () {
462
462
  _proto.reportChanged = function reportChanged() {
463
463
  startBatch();
464
464
  propagateChanged(this);
465
+ // We could update state version only at the end of batch,
466
+ // but we would still have to switch some global flag here to signal a change.
467
+ globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
465
468
  endBatch();
466
469
  };
467
470
  _proto.toString = function toString() {
@@ -1828,6 +1831,7 @@ var MobXGlobals = function MobXGlobals() {
1828
1831
  this.useProxies = true;
1829
1832
  this.verifyProxies = false;
1830
1833
  this.safeDescriptors = true;
1834
+ this.stateVersion = Number.MIN_SAFE_INTEGER;
1831
1835
  };
1832
1836
  var canMergeGlobalState = true;
1833
1837
  var isolateCalled = false;