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 +6 -0
- package/dist/mobx.cjs.development.js +6 -8
- 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 +6 -8
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +6 -8
- 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 +6 -8
- 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 +9 -11
package/package.json
CHANGED
package/src/core/atom.ts
CHANGED
|
@@ -68,21 +68,19 @@ export class Atom implements IAtom {
|
|
|
68
68
|
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
|
|
69
69
|
*/
|
|
70
70
|
public reportChanged() {
|
|
71
|
-
if (globalState.inBatch
|
|
72
|
-
//
|
|
73
|
-
|
|
71
|
+
if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
|
|
72
|
+
// We could update state version only at the end of batch,
|
|
73
|
+
// but we would still have to switch some global flag here to signal a change.
|
|
74
|
+
globalState.stateVersion =
|
|
75
|
+
globalState.stateVersion < Number.MAX_SAFE_INTEGER
|
|
76
|
+
? globalState.stateVersion + 1
|
|
77
|
+
: Number.MIN_SAFE_INTEGER
|
|
78
|
+
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
79
|
+
this.batchId_ = NaN
|
|
74
80
|
}
|
|
75
|
-
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
76
|
-
this.batchId_ = NaN
|
|
77
81
|
|
|
78
82
|
startBatch()
|
|
79
83
|
propagateChanged(this)
|
|
80
|
-
// We could update state version only at the end of batch,
|
|
81
|
-
// but we would still have to switch some global flag here to signal a change.
|
|
82
|
-
globalState.stateVersion =
|
|
83
|
-
globalState.stateVersion < Number.MAX_SAFE_INTEGER
|
|
84
|
-
? globalState.stateVersion + 1
|
|
85
|
-
: Number.MIN_SAFE_INTEGER
|
|
86
84
|
endBatch()
|
|
87
85
|
}
|
|
88
86
|
|