Skip to content

Commit 02280f0

Browse files
committed
fix retrocompatibility issues
1 parent 57520e2 commit 02280f0

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 1.11.5
4+
5+
- Fix: Some retrocompatibility issues with MobX 4/5.
6+
37
## 1.11.4
48

59
- Fix: redux devtools revert was not working correctly.

packages/lib/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { env } from "./env.js"
33
import swcConfig from "./swc.config.js"
44

55
const { mobxVersion, compiler } = env
6+
console.log(`Using mobxVersion=${mobxVersion}, compiler=${compiler}`)
67

78
const tsconfigFiles = {
89
6: compiler === "tsc" ? "tsconfig.json" : "tsconfig.experimental-decorators.json",

packages/lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobx-keystone",
3-
"version": "1.11.4",
3+
"version": "1.11.5",
44
"description": "A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more",
55
"keywords": [
66
"mobx",

packages/lib/src/wrappers/asMap.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import {
22
action,
33
IMapWillChange,
4-
intercept,
54
IObjectDidChange,
65
IObservableArray,
6+
intercept,
77
isObservableArray,
88
isObservableObject,
9-
observable,
109
ObservableMap,
10+
observable,
1111
observe,
1212
remove,
13+
runInAction,
1314
transaction,
1415
untracked,
1516
} from "mobx"
@@ -143,8 +144,10 @@ const observableMapBackedByObservableArray = <T>(
143144
return observable.map(array)
144145
} else {
145146
const map = observable.map()
146-
array.forEach(([k, v]) => {
147-
map.set(k, v)
147+
runInAction(() => {
148+
array.forEach(([k, v]) => {
149+
map.set(k, v)
150+
})
148151
})
149152
return map
150153
}

packages/lib/src/wrappers/asSet.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {
22
action,
3-
intercept,
43
IObservableArray,
54
ISetWillChange,
5+
intercept,
66
isObservableArray,
7-
observable,
87
ObservableSet,
8+
observable,
99
observe,
10+
runInAction,
1011
transaction,
1112
untracked,
1213
} from "mobx"
@@ -28,8 +29,10 @@ const observableSetBackedByObservableArray = <T>(
2829
return observable.set(array)
2930
} else {
3031
const set = observable.set()
31-
array.forEach((item) => {
32-
set.add(item)
32+
runInAction(() => {
33+
array.forEach((item) => {
34+
set.add(item)
35+
})
3336
})
3437
return set
3538
}

turbo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"mobx-keystone#test": {
3333
"dependsOn": [],
3434
"outputs": [],
35-
"env": ["COMPILER", "MOBX-VERSION"]
35+
"env": ["COMPILER", "MOBX_VERSION"]
3636
},
3737
"mobx-keystone-yjs#test": {
3838
"dependsOn": ["mobx-keystone#build"],
@@ -41,7 +41,7 @@
4141
"mobx-keystone#test:ci": {
4242
"dependsOn": [],
4343
"outputs": [],
44-
"env": ["COMPILER", "MOBX-VERSION"]
44+
"env": ["COMPILER", "MOBX_VERSION"]
4545
},
4646
"mobx-keystone-yjs#test:ci": {
4747
"dependsOn": ["mobx-keystone#build"],

0 commit comments

Comments
 (0)