mobx 6.8.0 → 6.9.0
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 +6 -0
- package/dist/core/globalstate.d.ts +4 -0
- package/dist/mobx.cjs.development.js +4 -0
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +4 -0
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +4 -0
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +4 -0
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core/atom.ts +8 -1
- package/src/core/globalstate.ts +5 -0
package/package.json
CHANGED
package/src/core/atom.ts
CHANGED
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
propagateChanged,
|
|
12
12
|
reportObserved,
|
|
13
13
|
startBatch,
|
|
14
|
-
Lambda
|
|
14
|
+
Lambda,
|
|
15
|
+
globalState
|
|
15
16
|
} from "../internal"
|
|
16
17
|
|
|
17
18
|
export const $mobx = Symbol("mobx administration")
|
|
@@ -66,6 +67,12 @@ export class Atom implements IAtom {
|
|
|
66
67
|
public reportChanged() {
|
|
67
68
|
startBatch()
|
|
68
69
|
propagateChanged(this)
|
|
70
|
+
// We could update state version only at the end of batch,
|
|
71
|
+
// but we would still have to switch some global flag here to signal a change.
|
|
72
|
+
globalState.stateVersion =
|
|
73
|
+
globalState.stateVersion < Number.MAX_SAFE_INTEGER
|
|
74
|
+
? globalState.stateVersion + 1
|
|
75
|
+
: Number.MIN_SAFE_INTEGER
|
|
69
76
|
endBatch()
|
|
70
77
|
}
|
|
71
78
|
|
package/src/core/globalstate.ts
CHANGED
|
@@ -150,6 +150,11 @@ export class MobXGlobals {
|
|
|
150
150
|
* configurable: true
|
|
151
151
|
*/
|
|
152
152
|
safeDescriptors = true
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Changes with each state update, used by useSyncExternalStore
|
|
156
|
+
*/
|
|
157
|
+
stateVersion = Number.MIN_SAFE_INTEGER
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
let canMergeGlobalState = true
|