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 +12 -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 +5 -1
- 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 +2 -2
- package/src/api/trace.ts +1 -1
- package/src/core/atom.ts +8 -1
- package/src/core/globalstate.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.1",
|
|
4
4
|
"description": "Simple, scalable state management.",
|
|
5
5
|
"source": "src/mobx.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
"test:coverage": "yarn test -i --coverage",
|
|
76
76
|
"test:size": "yarn import-size --report . observable computed autorun action",
|
|
77
77
|
"test:check": "yarn test:types",
|
|
78
|
-
"
|
|
78
|
+
"prepublishOnly": "node ./scripts/prepublish.js && yarn build --target publish"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/src/api/trace.ts
CHANGED
|
@@ -5,7 +5,7 @@ export function trace(thing?: any, enterBreakPoint?: boolean): void
|
|
|
5
5
|
export function trace(enterBreakPoint?: boolean): void
|
|
6
6
|
export function trace(...args: any[]): void {
|
|
7
7
|
if (!__DEV__) {
|
|
8
|
-
|
|
8
|
+
return
|
|
9
9
|
}
|
|
10
10
|
let enterBreakPoint = false
|
|
11
11
|
if (typeof args[args.length - 1] === "boolean") {
|
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
|