mobx 4.15.0 → 4.15.4
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 +827 -552
- package/README.md +155 -98
- package/lib/api/action.d.ts +13 -25
- package/lib/api/actiondecorator.d.ts +27 -16
- package/lib/api/autorun.d.ts +24 -24
- package/lib/api/become-observed.d.ts +5 -5
- package/lib/api/computed.d.ts +14 -14
- package/lib/api/configure.d.ts +19 -19
- package/lib/api/decorate.d.ts +6 -6
- package/lib/api/extendobservable.d.ts +7 -7
- package/lib/api/extras.d.ts +10 -10
- package/lib/api/flow.d.ts +9 -9
- package/lib/api/intercept-read.d.ts +8 -8
- package/lib/api/intercept.d.ts +8 -8
- package/lib/api/iscomputed.d.ts +3 -3
- package/lib/api/isobservable.d.ts +2 -2
- package/lib/api/object-api.d.ts +34 -34
- package/lib/api/observable.d.ts +54 -54
- package/lib/api/observabledecorator.d.ts +6 -6
- package/lib/api/observe.d.ts +8 -8
- package/lib/api/tojs.d.ts +11 -11
- package/lib/api/trace.d.ts +3 -3
- package/lib/api/transaction.d.ts +8 -8
- package/lib/api/when.d.ts +15 -15
- package/lib/core/action.d.ts +22 -22
- package/lib/core/atom.d.ts +40 -40
- package/lib/core/computedvalue.d.ts +93 -93
- package/lib/core/derivation.d.ts +74 -74
- package/lib/core/globalstate.d.ts +106 -106
- package/lib/core/observable.d.ts +44 -44
- package/lib/core/reaction.d.ts +63 -63
- package/lib/core/spy.d.ts +6 -6
- package/lib/index.js +7 -0
- package/lib/internal.d.ts +44 -44
- package/lib/mobx.d.ts +19 -19
- package/lib/mobx.es6.js +4340 -4330
- package/lib/mobx.js +4384 -4419
- package/lib/mobx.js.flow +1 -0
- package/lib/mobx.min.js +1 -1
- package/lib/mobx.module.js +4431 -4421
- package/lib/mobx.umd.js +4431 -4419
- package/lib/mobx.umd.min.js +1 -1
- package/lib/types/intercept-utils.d.ts +9 -9
- package/lib/types/listen-utils.d.ts +8 -8
- package/lib/types/modifiers.d.ts +7 -7
- package/lib/types/observablearray.d.ts +78 -78
- package/lib/types/observablemap.d.ts +83 -83
- package/lib/types/observableobject.d.ts +65 -65
- package/lib/types/observableset.d.ts +49 -49
- package/lib/types/observablevalue.d.ts +37 -37
- package/lib/types/type-utils.d.ts +4 -4
- package/lib/utils/comparer.d.ts +14 -14
- package/lib/utils/decorators2.d.ts +7 -7
- package/lib/utils/eq.d.ts +1 -1
- package/lib/utils/iterable.d.ts +5 -5
- package/lib/utils/utils.d.ts +43 -43
- package/package.json +7 -89
package/CHANGELOG.md
CHANGED
|
@@ -1,71 +1,325 @@
|
|
|
1
|
-
|
|
1
|
+
# 5.15.4 / 4.15.4
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
- Fix process.env replacement in build [#2267](https://github.com/mobxjs/mobx/pull/2267) by [@fredyc](https://github.com/fredyc)
|
|
4
|
+
|
|
5
|
+
# 5.15.3 / 4.15.3
|
|
6
|
+
|
|
7
|
+
- Define action name to be as the function name [#2262](https://github.com/mobxjs/mobx/pull/2262) by [@nadavkaner](https://github.com/nadavkaner)
|
|
8
|
+
|
|
9
|
+
# 5.15.2 / 4.15.2
|
|
10
|
+
|
|
11
|
+
- Fixed [#2230](https://github.com/mobxjs/mobx/issue/2230) computedvalue: throw error object instead of string when options is empty [#2243](https://github.com/mobxjs/mobx/pull/2243) by [@ramkumarvenkat](https://github.com/ramkumarvenkat)
|
|
12
|
+
- supports ES6 Sets and Maps in shallow comparer. [#2238](https://github.com/mobxjs/mobx/pull/2238) by [@hearnden](https://github.com/hearnden)
|
|
13
|
+
- `extendObservable`: can be used existing properties again. Fixes [#2250](https://github.com/mobxjs/mobx/issue/2250) through [#2252](https://github.com/mobxjs/mobx/pull/2252) by [@davefeucht](https://github.com/davefeucht)
|
|
14
|
+
|
|
15
|
+
# 5.15.1 / 4.15.1
|
|
16
|
+
|
|
17
|
+
- Make initial values of observable set accept readonly array [#2202](https://github.com/mobxjs/mobx/pull/2202)
|
|
18
|
+
- Expose `_allowStateReadsStart` & `_allowStateReadsEnd`. This is low level stuff you shouldn't need that's mostly useful for library creators. [#2233](https://github.com/mobxjs/mobx/pull/2233)
|
|
19
|
+
- Fixed an issue with `observableRequiresReaction` and updating observable during reaction [#2195](https://github.com/mobxjs/mobx/pull/2196)
|
|
20
|
+
- Improved type inference for `action` [#2213](https://github.com/mobxjs/mobx/pull/2213) ([see detailed explanation](https://github.com/mobxjs/mobx/pull/2218#discussion_r349889440))
|
|
21
|
+
|
|
22
|
+
# 5.15.0
|
|
23
|
+
|
|
24
|
+
**The minimum required TypeScript version is now 3.6**
|
|
25
|
+
|
|
26
|
+
- Fixed flow typings with Typescript v3.6. This means that version of Typescript is required when using flows.
|
|
27
|
+
- Cancelled flows now reject with a `FlowCancellationError` instance whose error message is the same as in previous versions (`"FLOW_CANCELLED"`) so this is not breaking. [#2172](https://github.com/mobxjs/mobx/pull/2172) by [@vonovak](https://github.com/vonovak)
|
|
28
|
+
- Fix running mobx in web worker [#2184](https://github.com/mobxjs/mobx/pull/2184/files) by [@shahata](https://github.com/shahata)
|
|
29
|
+
- Fixed flow typings for Facebook's Flow. A new `CancellablePromise` Flow type is exported. [#2164](https://github.com/mobxjs/mobx/pull/2164) by [@vonovak](https://github.com/vonovak)
|
|
30
|
+
- Added support for symbol keys on observable properties (MobX 5 only). [#2175](https://github.com/mobxjs/mobx/pull/2175) by [@StephenHaney](https://github.com/StephenHaney)
|
|
31
|
+
|
|
32
|
+
# 5.14.2
|
|
33
|
+
|
|
34
|
+
- Fixed installation issue trying to run `postinstall` hook for a website [#2165](https://github.com/mobxjs/mobx/issues/2165).
|
|
35
|
+
|
|
36
|
+
# 5.14.1 / 4.14.1
|
|
37
|
+
|
|
38
|
+
- Fixed a possible issue with action stack errors and multiple mobx versions installed at the same time [#2135](https://github.com/mobxjs/mobx/issues/2135).
|
|
39
|
+
- Added `comparer.shallow` for shallow object/array comparisons [#1561](https://github.com/mobxjs/mobx/issues/1561).
|
|
40
|
+
- Fixed disposing an interception within an interception throwing an error [#1950](https://github.com/mobxjs/mobx/issues/1950).
|
|
41
|
+
|
|
42
|
+
# 5.14.0 / 4.14.0
|
|
43
|
+
|
|
44
|
+
- Added experimental `reactionRequiresObservable` & `observableRequiresReaction` config [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)
|
|
45
|
+
- Added experimental `requiresObservable` config to `reaction`, `autorun` & `when` options [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)
|
|
46
|
+
|
|
47
|
+
# 5.13.1 / 4.13.1
|
|
48
|
+
|
|
49
|
+
- Don't use `global` and `self` keywords unless defined. Fixes [#2070](https://github.com/mobxjs/mobx/issues/2070).
|
|
50
|
+
- onBecome(Un)Observed didn't trigger when using number as key of observable map. Fixes [#2067](https://github.com/mobxjs/mobx/issues/2067).
|
|
51
|
+
- Exposed `_startAction` and `_endAction` to be able to start and action and finish it without needing a code block. This is low level stuff you shouldn't need that's mostly useful for library creators.
|
|
52
|
+
|
|
53
|
+
# 5.13.0 / 4.13.0
|
|
54
|
+
|
|
55
|
+
- Fixed potential memory leak in observable maps, when non-primitive values are used as keys. Fixes [#2031](https://github.com/mobxjs/mobx/issues/2031) through [#2032](https://github.com/mobxjs/mobx/pull/2032).
|
|
56
|
+
- Added support to store additional non-observable(!) fields (string or symbol based) on array, to better reflect behavior of MobX 4. Fixes [#2044](https://github.com/mobxjs/mobx/issues/2044) through [#2046](https://github.com/mobxjs/mobx/pull/2046)
|
|
57
|
+
|
|
58
|
+
# 5.11.0 / 4.12.0
|
|
59
|
+
|
|
60
|
+
- Added `computedConfigurable` config [#2011](https://github.com/mobxjs/mobx/pull/2011), [#2013](https://github.com/mobxjs/mobx/pull/2014)
|
|
61
|
+
|
|
62
|
+
# 4.11.0
|
|
63
|
+
|
|
64
|
+
**BREAKING CHANGE**
|
|
65
|
+
|
|
66
|
+
Reverted the support of Symbols in general in MobX 4, as it gives to many potential build errors and increases the system requirements for MobX 4 (which was an oversight in 4.10.0). Apologies for the breaking change (lack of new major version numbers). If lock files are properly used however, no harm should be caused by this change.
|
|
67
|
+
|
|
68
|
+
- Reverted `Symbol` support in observable maps and objects. Reverts [#1944](https://github.com/mobxjs/mobx/pull/1944) through [#1988](https://github.com/mobxjs/mobx/pull/1988). Fixes [#1986](https://github.com/mobxjs/mobx/issues/1986), [#1987](https://github.com/mobxjs/mobx/issues/1987)
|
|
69
|
+
|
|
70
|
+
# 5.10.1
|
|
71
|
+
|
|
72
|
+
- Fixed a recent regression where array update events would send undefined as `change.object` through [#1985](https://github.com/mobxjs/mobx/pull/1985) by [xaviergonz](https://github.com/xaviergonz)
|
|
73
|
+
|
|
74
|
+
# 5.10.0 / 4.10.0
|
|
75
|
+
|
|
76
|
+
- Added support for symbol named properties in maps and objects. Fixes [#1809](https://github.com/mobxjs/mobx/issues/1809) and [#1925](https://github.com/mobxjs/mobx/issues/1925) through [#1944](https://github.com/mobxjs/mobx/pull/1944) by [@loklaan](https://github.com/loklaan)
|
|
77
|
+
- Added `set` support for `observable.set`, see [#1945](https://github.com/mobxjs/mobx/pull/1945) by [xaviergonz](https://github.com/xaviergonz)
|
|
78
|
+
- Fixed events for arrays using the wrong object, [#1964](https://github.com/mobxjs/mobx/pull/1964) by [xaviergonz](https://github.com/xaviergonz)
|
|
79
|
+
- Improved flow typings [#1960](https://github.com/mobxjs/mobx/pull/1960) by [@tbezman](https://github.com/tbezman)
|
|
80
|
+
- Updated tooling, [#1949](https://github.com/mobxjs/mobx/pull/1949) and [#1931](https://github.com/mobxjs/mobx/pull/1931) by [xaviergonz](https://github.com/xaviergonz)
|
|
81
|
+
|
|
82
|
+
# 5.9.4 / 4.9.4
|
|
83
|
+
|
|
84
|
+
- Allow symbol keys in `ObservableMap`, see [#1930](https://github.com/mobxjs/mobx/pull/1930) by [pimterry](https://github.com/pimterry)
|
|
85
|
+
- Fixed type definitions of `toStringTag` for Maps and Sets, see [#1929](https://github.com/mobxjs/mobx/pull/1929) by [lennerd](https://github.com/lennerd)
|
|
86
|
+
|
|
87
|
+
# 4.9.3
|
|
88
|
+
|
|
89
|
+
- Fixed `observable.set` compatibility with IE 11, see [#1917](https://github.com/mobxjs/mobx/pull/1917) by [kalmi](https://github.com/kalmi)
|
|
90
|
+
|
|
91
|
+
# 4.9.2
|
|
92
|
+
|
|
93
|
+
- Fixed regression [#1878](https://github.com/mobxjs/mobx/issues/1878), accidental use of `Symbol` breaking Internet Explorer / React Native compatibility.
|
|
94
|
+
|
|
95
|
+
# 4.9.1
|
|
96
|
+
|
|
97
|
+
- Fixed regression in `toJS`: observable maps were not properly serialized. Fixes [#1875](https://github.com/mobxjs/mobx/issues/1875)
|
|
98
|
+
|
|
99
|
+
# 5.9.0 / 4.9.0
|
|
100
|
+
|
|
101
|
+
**Features**
|
|
102
|
+
|
|
103
|
+
- Introduced support for observable sets! Through [#1592](https://github.com/mobxjs/mobx/pull/1592) by [@newraina](https://github.com/newraina)
|
|
104
|
+
- `observable.box` now accepts an `equals` option, to be able to pass a custom comparision function. Through [#1862](https://github.com/mobxjs/mobx/pull/1862), [#1874](https://github.com/mobxjs/mobx/pull/1874) by [@fi3ework](https://github.com/fi3ework). Fixes [#1580](https://github.com/mobxjs/mobx/issues/1580)
|
|
105
|
+
- Improved logging of reactions; if an action throws an exception, errors in reactions that react to that are only logged as warnings. Fixes [#1836](https://github.com/mobxjs/mobx/issues/1836)
|
|
106
|
+
|
|
107
|
+
**Fixes**
|
|
108
|
+
|
|
109
|
+
- Improved typings for `flow`, see [#1827](https://github.com/mobxjs/mobx/pull/1827) by [@xaviergonz](https://github.com/xaviergonz)
|
|
110
|
+
- Don't allow subclassing map, fixes [#1858](https://github.com/mobxjs/mobx/issues/1858)
|
|
111
|
+
- Fixed `trace(true)` not being able to handle multi-line comments in traced function. Fixes [#1850](https://github.com/mobxjs/mobx/issues/1850)
|
|
112
|
+
- `@computed` now introduces non-configurable properties, to fail fast on incorrect inheritance or property deletion. Fixes [#1867](https://github.com/mobxjs/mobx/issues/1867)
|
|
113
|
+
- The options `enforceActions` and `isolateGlobalState` now work correctly when used together. Fixes [#1869](https://github.com/mobxjs/mobx/issues/1869)
|
|
114
|
+
|
|
115
|
+
# 5.8.0 / 4.8.0
|
|
116
|
+
|
|
117
|
+
- MobX now requires TypeScript 3 (this was already the case in 5.7.0, but in this version the difference is actually noticeable in the typings).
|
|
118
|
+
- Fixed array dehancer sometimes skipping. Fixes [#1839](https://github.com/mobxjs/mobx/issues/1839) through [#1841](https://github.com/mobxjs/mobx/pull/1841) by [k-g-a](https://github.com/k-g-a)
|
|
119
|
+
- Fixed issue where webpack 4 wouldn't use the ESM module [#1834](https://github.com/mobxjs/mobx/pull/1834) by [mrtnbroder](https://github.com/mrtnbroder)
|
|
120
|
+
- Improved type inference for `flow` in TypeScript 3. Fixes [#1816](https://github.com/mobxjs/mobx/issue/1816) through [#1825](https://github.com/mobxjs/mobx/pull/1825) by [ismailhabib](https://github.com/ismailhabib)
|
|
121
|
+
- Introduced support for global environment variable `IGNORE_MOBX_MINIFIY_WARNING=true` to skip the built-in minification warning. See [#1835](https://github.com/mobxjs/mobx/pull/1835) by [fi3ework](https://github.com/fi3ework)
|
|
122
|
+
- Fixed onBecome(Un)Observed dispoer cleanup. Fixes [#1537](https://github.com/mobxjs/mobx/issues/1537) through [#1833](https://github.com/mobxjs/mobx/pull/1833) by [fi3ework](https://github.com/fi3ework)
|
|
123
|
+
|
|
124
|
+
# 5.7.1 / 4.7.1
|
|
125
|
+
|
|
126
|
+
- Fixed [#1839](https://github.com/mobxjs/mobx/issues/1839), ObservableArrayAdministration.dehanceValues does not dehance last value.
|
|
127
|
+
|
|
128
|
+
# 5.7.0 / 4.7.0
|
|
129
|
+
|
|
130
|
+
- Upgraded typings to TypeScript 3
|
|
131
|
+
- Fixed [#1742](https://github.com/mobxjs/mobx/issues/1742), change detection fails when multiple mobx instances were active.
|
|
132
|
+
- Fixed [#1624](https://github.com/mobxjs/mobx/issues/1624), use built-in flow types for iterators
|
|
133
|
+
- Fixed [#1777](https://github.com/mobxjs/mobx/issues/1777) through [#1826](https://github.com/mobxjs/mobx/pull/1826), stack overflow exception, in development mode, when using `@computed` on a React component. The MobX 5 behavior here has been reverted to the MobX 4 behavior.
|
|
134
|
+
|
|
135
|
+
# 5.6.0 / 4.6.0
|
|
136
|
+
|
|
137
|
+
- `keepAlive` has become smarter and won't recomputed computed values that are kept alive, as long as they aren't read. Implements [#1534](https://github.com/mobxjs/mobx/issues/1534)
|
|
138
|
+
- Fixed [#1796](https://github.com/mobxjs/mobx/issues/1796), undeleting a property that had an initial value of `undefined` was undetected
|
|
139
|
+
- Improved Flow typings, see [#1794](https://github.com/mobxjs/mobx/pull/1794) and [#1786](https://github.com/mobxjs/mobx/pull/1786)
|
|
140
|
+
|
|
141
|
+
# 5.5.2 / 4.5.2
|
|
142
|
+
|
|
143
|
+
- Fixed bug in `toJS` not handling `null` values correctly. Fixes [#1557](https://github.com/mobxjs/mobx/issues/1557) through [#1783](https://github.com/mobxjs/mobx/pull/1783) by [@wangyiz4262](https://github.com/wangyiz4262)
|
|
144
|
+
|
|
145
|
+
# 5.5.1 / 4.5.1
|
|
146
|
+
|
|
147
|
+
- `toJS` now has a `recurseEverything` everything option, that even detects and converts observable objects that are "behind" non-observable objects. See [#1699](https://github.com/mobxjs/mobx/pull/1699) by [wangyiz4262](https://github.com/wangyiz4262)
|
|
148
|
+
- Added flow typings form `comparer`, see [#1751](https://github.com/mobxjs/mobx/pull/1752) by [pdong](https://github.com/pdong)
|
|
149
|
+
- Update flow typings for configuration options, [#1772](https://github.com/mobxjs/mobx/pull/1772) by [alexandersorokin](https://github.com/alexandersorokin)
|
|
150
|
+
|
|
151
|
+
# 5.5.0 / 4.5.0
|
|
152
|
+
|
|
153
|
+
(Minor version of `5` was bumped significantly to make the number better correlate together :-))
|
|
154
|
+
|
|
155
|
+
- Fixed [#1740](https://github.com/mobxjs/mobx/issues/1740): combining decorators and `extendObservable` in a class constructor caused errors to be thrown
|
|
156
|
+
- Fixed [#1739](https://github.com/mobxjs/mobx/issues/1740):
|
|
157
|
+
- Proxies: `delete`-ing a property was not always picked up by the reactivity system
|
|
158
|
+
- Non-proxies: `remove()`-ing a property was not always picked up by the `has()` and `get()` utilities
|
|
159
|
+
- `has` now returns `true` for computed fields
|
|
160
|
+
- `get` now returns a value for computed fields
|
|
161
|
+
- Introduced `_allowStateChangeInsideComputed`. Don't use it :-).
|
|
162
|
+
- MobX is now transpiled using babel 7
|
|
163
|
+
|
|
164
|
+
# 5.1.2 / 4.4.2
|
|
165
|
+
|
|
166
|
+
- Fixed [#1650](https://github.com/mobxjs/mobx/issues/1650), decorating fields with the name `toString` does not behave correctly.
|
|
167
|
+
|
|
168
|
+
# 5.1.1 / 4.4.1
|
|
169
|
+
|
|
170
|
+
- Improved typings of `decorate`, see [#1711](https://github.com/mobxjs/mobx/pull/1711) by [makepost](https://github.com/makepost)
|
|
171
|
+
|
|
172
|
+
# 5.1.0 / 4.4.0
|
|
173
|
+
|
|
174
|
+
- Improved handling of multiple MobX instances. MobX will no longer complain about being loaded multiple times (one should still prevent it though, to prevent blowing up bundle size!), but merge internal state by default. If multiple MobX versions need to be loaded, call `configure({ isolateGlobalState: true })`. Note that this means that observables from the different MobX instances won't cooperate. Fixes [#1681](https://github.com/mobxjs/mobx/issues/1681), [#1082](https://github.com/mobxjs/mobx/issues/1082)
|
|
175
|
+
- `enforceActions` options now supports the values: `"never"`, `"observed"` and `"always"` to make the behavior more clear. Fixes [#1680](https://github.com/mobxjs/mobx/issues/1680), [#1473](https://github.com/mobxjs/mobx/issues/1473)
|
|
176
|
+
|
|
177
|
+
# 5.0.5
|
|
178
|
+
|
|
179
|
+
- Fixed [#1667](https://github.com/mobxjs/mobx/issues/1667): creating a large array could result in undefined items (MobX 4.\* was not affected)
|
|
180
|
+
|
|
181
|
+
# 4.3.2 / 5.0.4
|
|
182
|
+
|
|
183
|
+
- Fixed [#1685](https://github.com/mobxjs/mobx/issues/1685): expose `IAutorunOptions`
|
|
184
|
+
- `decorate` now can apply multiple decorators, by accepting an array and applying them right to left: `decorate(Todo, { title: [serializable(primitive), persist('object'), observable] })`. By [@ramybenaroya](https://github.com/ramybenaroya) through [#1691](https://github.com/mobxjs/mobx/pull/1691) and [#1686](https://github.com/mobxjs/mobx/pull/1686)
|
|
185
|
+
- Improved typings of `flow` so that it accepts async generators. By [@dannsam](https://github.com/dannsam) through [#1656](https://github.com/mobxjs/mobx/pull/1656) and [#1655](https://github.com/mobxjs/mobx/pull/1655)
|
|
186
|
+
- `keys()` now also supports arrays. Fixes [#1600](https://github.com/mobxjs/mobx/pull/1600) through [#1601](https://github.com/mobxjs/mobx/pull/1601) by [@nunocastromartins](https://github.com/nunocastromartins)
|
|
187
|
+
|
|
188
|
+
# 5.0.3
|
|
189
|
+
|
|
190
|
+
- Fixed issue where it was no longer possible to define custom properties on observable arrays
|
|
191
|
+
|
|
192
|
+
# 5.0.2
|
|
193
|
+
|
|
194
|
+
- Fixed issue where iterators where not compiled to ES5, breaking the ES5 based builds.
|
|
195
|
+
|
|
196
|
+
# 5.0.1 (Unpublished)
|
|
197
|
+
|
|
198
|
+
- Fixed regression bug: `ObservableMap.size` was no longer observable. Fixes [#1583](https://github.com/mobxjs/mobx/issues/1583)
|
|
199
|
+
- Downgraded lib export from ES6 to ES5. To many build tools still trip over ES6. Fixes [#1584](https://github.com/mobxjs/mobx/issues/1584). A modern build is available through `import ... from "mobx/lib/mobx.es6"` (or setup an alias in your build system)
|
|
200
|
+
- Added support for mobx-react-devtools
|
|
201
|
+
|
|
202
|
+
# 5.0.0
|
|
203
|
+
|
|
204
|
+
[Release blogpost](https://medium.com/p/4852bce05572/)
|
|
205
|
+
|
|
206
|
+
### Proxy support!
|
|
207
|
+
|
|
208
|
+
MobX 5 is the first MobX version fully leveraging Proxies. This has two big advantages
|
|
209
|
+
|
|
210
|
+
1. MobX can now detect the addition of properties on plain observable objects, so it is now possible to use plain observable objects as dynamic collections.
|
|
211
|
+
2. Observable arrays are now recognized as arrays by all third party libraries, which will avoid the need to slice them.
|
|
212
|
+
|
|
213
|
+
### The system requirements to run MobX has been upped
|
|
214
|
+
|
|
215
|
+
- MobX 5 can only be used on environments that support `Proxies`. See the [browser support](https://github.com/mobxjs/mobx#browser-support) for details.
|
|
216
|
+
- Since MobX no longer runs on older browsers, the compilation target has been upgraded to ES2015 syntax supporting browsers. This means that MobX is not loadable on older browsers without down compilation to ES5.
|
|
217
|
+
- If for whatever reason your project cannot meet this requirements, please stick to MobX 4. It will be actively maintained. All current features of MobX 5 are expressable in MobX 4 as well, but it means that for example to use dynamic objects some [additional APIs](https://mobx.js.org/refguide/object-api.html) are needed.
|
|
218
|
+
- The performance footprint of MobX 5 should be pretty similar to MobX 4. In our performance tests we saw some minor improvements in memory footprint, but overall it should be pretty comparable.
|
|
219
|
+
|
|
220
|
+
### Breaking changes
|
|
221
|
+
|
|
222
|
+
- The required runtime needs to support the non-polyfillable `Proxy` API.
|
|
223
|
+
- The minimum runtime target is now ES2015, not ES5
|
|
224
|
+
- `spy` has become a no-op in production builds
|
|
225
|
+
- All earlier deprecated APIs are dropped. Make sure to not have any deprecation warnings before upgrading.
|
|
226
|
+
- `array.move` and `array.peek` are removed from the API
|
|
227
|
+
- Dropped the third argument to `array.find` and `array.findIndex` since they were not standardized in ES.
|
|
228
|
+
- `.$mobx` property has been dropped from all observables and replaced by a Symbol. Instead of using `x.$mobx.name`, use `import { $mobx } from "mobx"; x[$mobx].name` etc.
|
|
229
|
+
- In some cases, the order in which autoruns are fired could have changed due to some internal optimizations (note that MobX never had a guarantee about the order in which autoruns fired!)
|
|
230
|
+
|
|
231
|
+
### New features
|
|
232
|
+
|
|
233
|
+
- It is possible to pass the `proxy: false` argument to `observable.object` to disable proxying (theoretically slightly faster, but removes no dynamic key addition)
|
|
234
|
+
|
|
235
|
+
### Known Issues
|
|
236
|
+
|
|
237
|
+
- Observable objects can no longer be frozen (otherwise they would become un-observable😎). If you are actually trying to do so MobX will now throw an exception like: `[mobx] Dynamic observable objects cannot be frozen]`. A place where that might happen unexpectedly is when passing an observable object as `style` property to a React component. Like `<span style={someObservableObject} />`, since React will freeze all style objects. The work-around is to simply pass a fresh, non-observable object for styling like: `<span style={{...someObservableObject}} />`.
|
|
238
|
+
- ~~If you are using `mobx` with `mobx-react`, and you are upgrading `mobx-react` to the MobX 5 compatible version (`mobx-react@5.2.0`) you will notice that `this.props` or `this.state` are not yet observable in the `constructor` or `componentWillMount`. This is for forward compatibility with React 16.3 where `componentWillMount` has been deprecated. In most cases using `componentDidMount` instead will suffice, especially when the goal is to setup reactions. For more info see [#478](https://github.com/mobxjs/mobx-react/issues/478).~~ Fixed in mobx-react 5.2.1. But note that you should still migrate away from `componentWillMount`😎.
|
|
239
|
+
- Jest `toEqual` might throw an error `allKeys[x].match is not a function` when trying to equal observable arrays. This is a bug in Jest [report](https://github.com/facebook/jest/issues/6398). The simple work around for now is to slice (or `toJS` if the problem is recursive) the array first.
|
|
240
|
+
- Jest `toEqual` matcher might no longer correctly equal your class instances, complaining about differences in the MobX adminstration. This is due to a bug with the processing of symbols: [report](https://github.com/facebook/jest/issues/6392). For now you might want to use a custom matcher if you are directly equalling observable objects. As a work around `toJS(object)` could be used before diffing.
|
|
241
|
+
|
|
242
|
+
_Note June 7th, 2018:_ Both issues are already in Jest master and should be released soon.
|
|
243
|
+
|
|
244
|
+
### Migration guide
|
|
245
|
+
|
|
246
|
+
- Make sure to not use any API that produces deprecation warnings in MobX 4. Beyond that MobX 5 should pretty well as drop-in replacement of MobX 4.
|
|
247
|
+
- You _could_ perform the following clean ups:
|
|
248
|
+
- Don't `slice()` arrays when passing them to external libraries. (Note you still shouldn't pass observable data structures to non-`observer` React components, which is an orthogonal concept)
|
|
249
|
+
- You could replace observable maps with observable objects if you are only using string-based keys.
|
|
250
|
+
- Don't call the `reverse` or `sort` operations directly on observableArray's anymore, as it's behavior slightly differed from the built-in implementations of those methods. Instead use `observableArray.slice().sort()` to perform the sort on a copy. This gives no additional performance overhead compared to MobX 4. (The reason behind this is that built-in `sort` updates the array in place, but the observable array implementation always performed the sort on a defensive copy, and this change makes that explicit).
|
|
251
|
+
- you may remove usages of `isArrayLike()` since `Array.isArray()` will now return true for observable arrays
|
|
252
|
+
|
|
253
|
+
### API's that have been dropped
|
|
254
|
+
|
|
255
|
+
- The `arrayBuffer` setting is no longer supported by `configure` (it has become irrelevant)
|
|
256
|
+
- `observable.shallowBox`, `observable.shallowArray`, `observable.shallowMap`, `observable.shallowObject`, `extendShallowObservable` api's have been removed. Instead, pass `{ deep: false }` to their non-shallow counter parts.
|
|
257
|
+
- `observableArray.peek`, `observableArray.move`
|
|
4
258
|
|
|
5
259
|
# 4.3.1
|
|
6
260
|
|
|
7
|
-
|
|
8
|
-
|
|
261
|
+
- Fixed [#1534](Fixes https://github.com/mobxjs/mobx/issues/1534): @computed({keepAlive: true}) no long calculates before being accessed.
|
|
262
|
+
- Added the `$mobx` export symbol for MobX 5 forward compatibity
|
|
9
263
|
|
|
10
264
|
# 4.3.0
|
|
11
265
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
266
|
+
- Introduced the `entries(observable)` API, by @samjacobclift through [#1536](https://github.com/mobxjs/mobx/pull/1536)
|
|
267
|
+
- Fixed [#1535](https://github.com/mobxjs/mobx/issues/1535): Change in nested computed value was not propagated if read outside action context when there is a pending reaction. For more details see the exact test case.
|
|
268
|
+
- Illegal property access through prototypes is now a warning instead of an error. Fixes [#1506](https://github.com/mobxjs/mobx/issues/1506). By @AmazingTurtle through [#1529](https://github.com/mobxjs/mobx/pull/1529)
|
|
269
|
+
- Fixed issue where providing a custom setter to `@computed({ set: ... })` wasn't picked up
|
|
270
|
+
- Fixed #1545: Actions properties where not re-assignable when using TypeScript
|
|
271
|
+
- Illegal Access checks are now a warning instead of an error. Fix
|
|
18
272
|
|
|
19
273
|
# 4.2.1
|
|
20
274
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
275
|
+
- Fixed flow typings for `mobx.configure` [#1521](https://github.com/mobxjs/mobx/pull/1521) by @andrew--r
|
|
276
|
+
- Improved typings for `mobx.flow`, fixes [#1527](https://github.com/mobxjs/mobx/issues/1527)
|
|
277
|
+
- Throw error when using `@observable` in combination with a getter. [#1511](https://github.com/mobxjs/mobx/pull/1511) by @quanganhtran
|
|
278
|
+
- `toJS` now uses Map internally, for faster detection of cycles. [#1517](https://github.com/mobxjs/mobx/pull/1517) by @loatheb
|
|
279
|
+
- Fixed [#1512](https://github.com/mobxjs/mobx/issues/1512): `observe` hooks not being triggered when using `mobx.set`, Fixed in [#1514](https://github.com/mobxjs/mobx/pull/1514) by @quanganhtran
|
|
280
|
+
- Several minor improvements, additional tests and doc improvements.
|
|
27
281
|
|
|
28
282
|
# 4.2.0
|
|
29
283
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
284
|
+
- Introduced `configure({ enforceActions: "strict" })`, which is more strict then `enforceActions: true`, as it will also throw on non-observed changes to observables. See also [#1473](https://github.com/mobxjs/mobx/issues/1473)
|
|
285
|
+
- Fixed [#1480](https://github.com/mobxjs/mobx/issues/1480): Exceptions in the effect handler of `reaction` where not properly picked up by the global reaction system
|
|
286
|
+
- Fixed a bug where computed values updated their cached value, even when the comparer considered the new value equal to the previous one. Thanks @kuitos for finding this and fixing it! [#1499](https://github.com/mobxjs/mobx/pull/1499)
|
|
287
|
+
- Undeprecated `ObservableMap`, fixes [#1496](https://github.com/mobxjs/mobx/issues/1496)
|
|
288
|
+
- Observable arrays now support `Symbol.toStringTag` (if available / polyfilled). This allows libraries like Ramda to detect automatically that observable arrays are arrays. Fixes [#1490](https://github.com/mobxjs/mobx/issues/1490). Note that `Array.isArray` will keep returning false for the entire MobX 4 range.
|
|
289
|
+
- Actions are now always `configurable` and `writable`, like in MobX 3. Fixes [#1477](https://github.com/mobxjs/mobx/issues/1477)
|
|
290
|
+
- Merged several improvements to the flow typings. [#1501](https://github.com/mobxjs/mobx/pull/1501) by @quanganhtran
|
|
291
|
+
- Fixed several accidental usages of the global `fail`, by @mtaran-google through [#1483](https://github.com/mobxjs/mobx/pull/1483) and [#1482](https://github.com/mobxjs/mobx/pull/1482)
|
|
38
292
|
|
|
39
293
|
# 4.1.1
|
|
40
294
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
295
|
+
- Import `default` from MobX will no longer throw, but only warn instead. This fixes some issues with tools that reflect on the `default` export of a module
|
|
296
|
+
- Disposing a spy listener inside a spy handler no longer causes an exception. Fixes [#1459](https://github.com/mobxjs/mobx/issues/1459) through [#1460](https://github.com/mobxjs/mobx/pull/1460) by [farwayer](https://github.com/farwayer)
|
|
297
|
+
- Added a missing `runInAction` overload in the flow typings. [#1451](https://github.com/mobxjs/mobx/pull/1451) by [AMilassin](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3AAMilassin)
|
|
298
|
+
- Improved the typings of `decorate`. See [#1450](https://github.com/mobxjs/mobx/pull/1450) by [makepost](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3Amakepost)
|
|
45
299
|
|
|
46
300
|
# 4.1.0
|
|
47
301
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
302
|
+
- Introduced `keepAlive` as option to `computed`
|
|
303
|
+
- All observable api's now default to `any` for their generic arguments
|
|
304
|
+
- Improved `flow` cancellation
|
|
305
|
+
- The effect of `when` is now automatically an action.
|
|
306
|
+
- `@computed` properties are now declared on their owner rather then the protoptype. Fixes an issue where `@computed` fields didn't work in React Native on proxied objects. See [#1396](https://github.com/mobxjs/mobx/issues/1396)
|
|
307
|
+
- `action` and `action.bound` decorated fields are now reassignable, so that they can be stubbed
|
|
54
308
|
|
|
55
309
|
# 4.0.2
|
|
56
310
|
|
|
57
|
-
|
|
58
|
-
|
|
311
|
+
- Fixed issue where exceptions like `TypeError: Cannot define property:__mobxDidRunLazyInitializers, object is not extensible.` were thrown. Fixes [#1404](https://github.com/mobxjs/mobx/issues/1404)
|
|
312
|
+
- Improved flow typings for `flow`, [#1399](https://github.com/mobxjs/mobx/pull/1399) by @ismailhabib
|
|
59
313
|
|
|
60
314
|
# 4.0.1
|
|
61
315
|
|
|
62
|
-
|
|
316
|
+
- Updated flow typings, see [#1393](https://github.com/mobxjs/mobx/pull/1393) by [andrew--r](https://github.com/andrew--r)
|
|
63
317
|
|
|
64
318
|
# 4.0.0
|
|
65
319
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
320
|
+
- For the highlights of this release, read the [blog](https://medium.com/p/c1fbc08008da/):
|
|
321
|
+
- For migration notes: see the [wiki page](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)
|
|
322
|
+
- Note; many things that were removed to make the api surface smaller. If you think some feature shouldn't have been removed, feel free to open an issue!
|
|
69
323
|
|
|
70
324
|
This is the extensive list of all changes.
|
|
71
325
|
|
|
@@ -73,277 +327,280 @@ This is the extensive list of all changes.
|
|
|
73
327
|
|
|
74
328
|
The changes mentioned here are discussed in detail in the [release highlights](https://medium.com/p/c1fbc08008da/), or were simply updated in the docs.
|
|
75
329
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
330
|
+
- MobX 4 introduces separation between the production and non production build. The production build strips most typechecks, resulting in a faster and smaller build. Make sure to substitute process.env.NODE_ENV = "production" in your build process! If you are using MobX in a react project, you most probably already have set this up. Otherwise, the idea is explained [here](https://reactjs.org/docs/add-react-to-an-existing-app.html).
|
|
331
|
+
- Introduced `flow` to create a chain of async actions. This is the same function as [`asyncActions`](https://github.com/mobxjs/mobx-utils#asyncaction) of the mobx-utils package
|
|
332
|
+
- These `flow`'s are now cancellable, by calling `.cancel()` on the returned promise, which will throw a cancellation exception into the generator function.
|
|
333
|
+
- `flow` also has experimental support for async iterators (`async * function`)
|
|
334
|
+
- Introduced `decorate(thing, decorators)` to decorate classes or object without needing decorator syntax.
|
|
335
|
+
- Introduced `onBecomeObserved` and `onBecomeUnobserved`. These API's enable hooking into the observability system and get notified about when an observable starts / stops becoming used. This is great to automaticaly fetch data from external resources, or stop doing so.
|
|
336
|
+
- `computed` / `@computed` now accepts a `requiresReaction` option. If it set, the computed value will throw an exception if it is being read while not being tracked by some reaction.
|
|
337
|
+
- To make `requiresReaction` the default, use `mobx.configure({ computedRequiresReaction: true })`
|
|
338
|
+
- Introduced `mobx.configure({ disableErrorBoundaries })`, for easier debugging of exceptoins. By [NaridaL](https://github.com/NaridaL) through [#1262](https://github.com/mobxjs/mobx/pull/1262)
|
|
339
|
+
- `toJS` now accepts the options: `{ detectCycles?: boolean, exportMapsAsObjects?: boolean }`, both `true` by default
|
|
340
|
+
- Observable maps are now backed by real ES6 Maps. This means that any value can be used as key now, not just strings and numbers.
|
|
341
|
+
- The flow typings have been updated. Since this is a manual effort, there can be mistakes, so feel free to PR!
|
|
342
|
+
|
|
343
|
+
- `computed(fn, options?)` / `@computed(options) get fn()` now accept the following options:
|
|
344
|
+
|
|
345
|
+
- `set: (value) => void` to set a custom setter on the computed property
|
|
346
|
+
- `name: "debug name"`
|
|
347
|
+
- `equals: fn` the equality value to use for the computed to determine whether its output has changed. The default is `comparer.default`. Alternatives are `comparer.structural`, `comparer.identity` or just your own comparison function.
|
|
348
|
+
- `requiresReaction: boolean` see above.
|
|
349
|
+
|
|
350
|
+
- `autorun(fn, options?)` now accepts the following options:
|
|
351
|
+
|
|
352
|
+
- `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`
|
|
353
|
+
- `name: "debug name"`
|
|
354
|
+
- `scheduler: function` a custom scheduler to run the autorun. For example to connect running the autorun to `requestAnimationFrame`. See the docs for more details
|
|
355
|
+
- `onError`. A custom error handler to be notified when an autorun throws an exception.
|
|
356
|
+
|
|
357
|
+
- `reaction(expr, effect, options?)` now accepts the following options:
|
|
358
|
+
|
|
359
|
+
- `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`
|
|
360
|
+
- `fireImmediately`. Immediately fire the effect function after the first evaluation of `expr`
|
|
361
|
+
- `equals`. Custom equality function to determine whether the `expr` function differed from its previous result, and hence should fire `effect`. Accepts the same options as the `equals` option of computed.
|
|
362
|
+
- All the options `autorun` accepts
|
|
363
|
+
|
|
364
|
+
- `when(predicate, effect?, options?)` now accepts the following options:
|
|
365
|
+
- `name: "debug name"`
|
|
366
|
+
- `onError`. A custom error handler to be notified when an autorun throws an exception.
|
|
367
|
+
- `timeout: number` a timeout in milliseconds, after which the `onError` handler will be triggered to signal the condition not being met within a certain time
|
|
368
|
+
- The `effect` parameter of `when` has become optional. If it is omitted, `when` will return a promise. This makes it easy to `await` a condition, for example: `await when(() => user.profile.loaded)`. The returned promise can be cancelled using `promise.cancel()`
|
|
369
|
+
|
|
370
|
+
- There is now an utility API that enables manipulating observable maps, objects and arrays with the same api. These api's are fully reactive, which means that even new property declarations can be detected by mobx if `set` is used to add them, and `values` or `keys` to iterate them.
|
|
371
|
+
|
|
372
|
+
- `values(thing)` returns all values in the collection as array
|
|
373
|
+
- `keys(thing)` returns all keys in the collection as array
|
|
374
|
+
- `set(thing, key, value)` or `set(thing, { key: value })` Updates the given collection with the provided key / value pair(s).
|
|
375
|
+
- `remove(thing, key)` removes the specified child from the collection. For arrays splicing is used.
|
|
376
|
+
- `has(thing, key)` returns true if the collection has the specified _observable_ property.
|
|
377
|
+
- `get(thing, key)` returns the chlid under the specified key.
|
|
378
|
+
|
|
379
|
+
- `observable`, `observable.array`, `observable.object`, `observable.map` and `extendObservable` now accept an additional options object, which can specify the following attributes:
|
|
380
|
+
- `name: "debug name"`
|
|
381
|
+
- `deep: boolean`. `true` by default, indicates whether the children of this collection are automatically converted into observables as well.
|
|
382
|
+
- `defaultDecorator: <decorator>` specifies the default decorator used for new children / properties, by default: `observable.deep`, but could be changed to `observable.ref`, `observable.struct` etc. (The `deep` property is just a short-hand for switching between `observable.deep` or `observable.ref` as default decorator for new properties)
|
|
126
383
|
|
|
127
384
|
### Breaking changes
|
|
128
385
|
|
|
129
386
|
The changes mentioned here are discussed in detail in the [migration notes](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)
|
|
130
387
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
388
|
+
- MobX 4 requires `Map` to be globally available. Polyfill it if targeting IE < 11 or other older browsers.
|
|
389
|
+
- For typescript users, MobX now requires `Map` and several `Symbol`s to exist for its typings. So make sure that the `lib` configuration of your project is set to `"es6"`. (The compilation target can still be `"es5"`)
|
|
390
|
+
- `observable.shallowArray(values)` has been removed, instead use `observable.array(values, { deep: false })`
|
|
391
|
+
- `observable.shallowMap(values)` has been removed, instead use `observable.map(values, { deep: false })`
|
|
392
|
+
- `observable.shallowObject(values)` has been removed, instead use `observable.object(values, {}, { deep: false })`
|
|
393
|
+
- `extendShallowObservable(target, props)`, instead use `extendObservable(target, props, {}, { deep: false })`
|
|
394
|
+
- The decorators `observable.ref`, `observable.shallow`, `observable.deep`, `observable.struct` can no longer be used as functions. Instead, they should be passed as part of the `decorators` param to resp. `observable.object` and `extendObservable`
|
|
395
|
+
- The new signature of `extendObservable` is `extendObservable(target, props, decorators?, options?)`. This also means it is no longer possible to pass multiple bags of properties to `extendObservable`. ~~`extendObservable` can no longer be used to re-declare properties. Use `set` instead to update existing properties (or introduce new ones).~~ Update 13-01-2020: the latter limitation has been reverted in MobX 4.15.2 / 5.15.2
|
|
396
|
+
- Iterating maps now follows the spec, that is, `map.values()`, `map.entries()`, `map.keys()`, `map[@@iterator]()` and `array[@@iterator]()` no longer return an array, but an iterator. Use `mobx.values(map)` or `Array.from(map)` to convert the iterators to arrays.
|
|
397
|
+
- dropped `@computed.equals`, instead, you can now use `@computed({ equals: ... })`
|
|
398
|
+
- `useStrict(boolean)` was dropped, use `configure({ enforceActions: boolean })` instead
|
|
399
|
+
- `isolateGlobalState` was dropped, use `configure({ isolateGlobalState: true})` instead
|
|
400
|
+
- If there are multiple mobx instances active in a single project, an exception will be thrown. Previously only a warning was printed. Fixes #1098. For details, see [#1082](https://github.com/mobxjs/mobx/issues/1082).
|
|
401
|
+
- Dropped the `shareGlobalState` feature. Instead, projects should be setup properly and it is up to the hosting package to make sure that there is only one MobX instance
|
|
402
|
+
- `expr` has been moved to mobx-utils. Remember, `expr(fn)` is just `computed(fn).get()`
|
|
403
|
+
- `createTransformer` has been moved to mobx-utils
|
|
404
|
+
- Passing `context` explicitly to `autorun`, `reaction` etc is no longer supported. Use arrow functions or function.bind instead.
|
|
405
|
+
- Removed `autorunAsync`. Use the `delay` option of `autorun` instead.
|
|
406
|
+
- `autorun`, `when`, `reaction` don't support name as first argument anymore, instead pass the `name` option.
|
|
407
|
+
- The `extras.` namespace has been dropped to enable tree-shaking non-used MobX features. All methods that where there originally are now exported at top level. If they are part of the official public API (you are encouraged to use them) they are exported as is. If they are experimental or somehow internal (you are discouraged to use them), they are prefixed with `_`.
|
|
408
|
+
- Dropped bower support. Fixes #1263
|
|
409
|
+
- The `spyReportStart`, `spyReportEnd`, `spyReport` and `isSpyEnabled` are no longer public. It is no longer possible to emit custom spy events as to avoid confusing in listeners what the possible set of events is.
|
|
410
|
+
- Dropped `isStrictModeEnabled`
|
|
411
|
+
- `observable(value)` will only succeed if it can turn the value into an observable data structure (a Map, Array or observable object). But it will no longer create an observable box for other values to avoid confusion. Call `observable.box(value)` explictly in such cases.
|
|
412
|
+
- `isComputed` and `isObservable` no longer accept a property as second argument. Instead use `isComputedProp` and `isObservableProp`.
|
|
413
|
+
- Removed `whyRun`, use `trace` instead
|
|
414
|
+
- The spy event signature has slightly changed
|
|
415
|
+
- The `Atom` class is no longer exposed. Use `createAtom` instead (same signature).
|
|
416
|
+
- Calling reportObserved() on a self made atom will no longer trigger the hooks if reportObserved is triggered outside a reactive context.
|
|
417
|
+
- The options `struct` and `compareStructural` for computed values are deprecated, use `@computed.struct` or `computed({ equals: comparer.structural})` instead.
|
|
418
|
+
- `isModifierDescriptor` is no longer exposed.
|
|
419
|
+
- `deepEqual` is no longer exposed, use `comparer.structural` instead.
|
|
420
|
+
- `setReactionScheduler` -> `configure({ reactionScheduler: fn })`
|
|
421
|
+
- `reserveArrayBuffer` -> `configure({ reactionErrorHandler: fn })`
|
|
422
|
+
- `ObservableMap` is no longer exposed as constructor, use `observable.map` or `isObservableMap` instead
|
|
423
|
+
- `map` -> `observable.map`
|
|
424
|
+
- `runInAction` no longer accepts a custom scope
|
|
425
|
+
- Dropped the already deprecated and broken `default` export that made it harder to tree-shake mobx. Make sure to always use `import { x } from "mobx"` and not `import mobx from "mobx"`.
|
|
426
|
+
- Killed the already deprecated modifiers `asFlat` etc. If you war still using this, see the MobX 2 -> 3 migration notes.
|
|
427
|
+
- Observable maps now fully implement the map interface. See [#1361](https://github.com/mobxjs/mobx/pull/1361) by [Marc Fallows](https://github.com/marcfallows)
|
|
428
|
+
- Observable arrays will no longer expose the `.move` method
|
|
429
|
+
- Dropped the `observable.deep.struct` modifier
|
|
430
|
+
- Dropped the `observable.ref.struct` modifier
|
|
431
|
+
- `observable.struct` now behaves like `observable.ref.struct` (this used to be `observable.deep.struct`). That is; values in an `observable.struct` field will be stored as is, but structural comparison will be used when assigning a new value
|
|
432
|
+
- IReactionDisposer.onError has been removed, use the `onError` option of reactions instead
|
|
176
433
|
|
|
177
434
|
### Issues fixed in this release:
|
|
178
435
|
|
|
179
436
|
The issues are incoprorated in the above notes.
|
|
180
437
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
438
|
+
- [#1316](https://github.com/mobxjs/mobx/issues/1316) - Improve `observable` api
|
|
439
|
+
- [#992](https://github.com/mobxjs/mobx/issues/992) - `onBecomeObserved` & `onBecomeUnobserved`
|
|
440
|
+
- [#1301](https://github.com/mobxjs/mobx/issues/1301) - Set `onError` handler when creating reactions
|
|
441
|
+
- [#817](https://github.com/mobxjs/mobx/issues/817) - Improve typings of `observe`
|
|
442
|
+
- [#800](https://github.com/mobxjs/mobx/issues/800) - Use `Map` as backend implementation of observable maps
|
|
443
|
+
- [#1361](https://github.com/mobxjs/mobx/issues/1361) - Make observableMaps structurally correct maps
|
|
444
|
+
- [#813](https://github.com/mobxjs/mobx/issues/813) - Create separate dev and production builds
|
|
445
|
+
- [#961](https://github.com/mobxjs/mobx/issues/961), [#1197](https://github.com/mobxjs/mobx/issues/1197) - Make it possible to forbid reading an untracked computed value
|
|
446
|
+
- [#1098](https://github.com/mobxjs/mobx/issues/1098) - Throw instead of warn if multiple MobX instances are active
|
|
447
|
+
- [#1122](https://github.com/mobxjs/mobx/issues/1122) - Atom hooks fired to often for observable maps
|
|
448
|
+
- [#1148](https://github.com/mobxjs/mobx/issues/1148) - Disposer of reactions should also cancel all scheduled effects
|
|
449
|
+
- [#1241](https://github.com/mobxjs/mobx/issues/1241) - Make it possible to disable error boundaries, to make it easier to find exceptions
|
|
450
|
+
- [#1263](https://github.com/mobxjs/mobx/issues/1263) - Remove bower.json
|
|
194
451
|
|
|
195
452
|
# 3.6.2
|
|
196
453
|
|
|
197
|
-
|
|
454
|
+
- Fixed accidental dependency on the `node` typings. Fixes [#1387](https://github.com/mobxjs/mobx/issues/1387) / [#1362](https://github.com/mobxjs/mobx/issues/1387)
|
|
198
455
|
|
|
199
456
|
# 3.6.1
|
|
200
457
|
|
|
201
|
-
|
|
458
|
+
- Fixed [#1358](https://github.com/mobxjs/mobx/pull/1359): Deep comparison failing on IE11. By [le0nik](https://github.com/le0nik) through [#1359](https://github.com/mobxjs/mobx/pull/1359)
|
|
202
459
|
|
|
203
460
|
# 3.6.0
|
|
204
461
|
|
|
205
|
-
|
|
462
|
+
- Fixed [#1118](https://github.com/mobxjs/mobx/issues/1118), the deepEquals operator build into mobx gave wrong results for non-primitive objects. This affected for example `computed.struct`, or the `compareStructural` of `reaction`
|
|
206
463
|
|
|
207
464
|
# 3.5.0/1
|
|
208
465
|
|
|
209
|
-
|
|
210
|
-
|
|
466
|
+
- Introduced `trace` for easier debugging of reactions / computed values. See the [docs](https://mobx.js.org/best/trace.html) for details.
|
|
467
|
+
- Improved typings of `observableArray.find`, see [#1324](https://github.com/mobxjs/mobx/pull/1324) for details.
|
|
211
468
|
|
|
212
469
|
# 3.4.1
|
|
213
470
|
|
|
214
|
-
|
|
471
|
+
- Republished 3.4.0, because the package update doesn't seem to distibute consistently through yarn / npm
|
|
215
472
|
|
|
216
473
|
# 3.4.0
|
|
217
474
|
|
|
218
|
-
|
|
475
|
+
- Improve Flow support by exposing typings regularly. Flow will automatically include them now. In your `.flowconfig` will have to remove the import in the `[libs]` section (as it's done [here](https://github.com/mobxjs/mobx/pull/1254#issuecomment-348926416)). Fixes [#1232](https://github.com/mobxjs/mobx/issues/1232).
|
|
219
476
|
|
|
220
477
|
# 3.3.3
|
|
221
478
|
|
|
222
|
-
|
|
223
|
-
|
|
479
|
+
- Fixed regression bug where observable map contents could not be replaced using another observable map [#1258](https://github.com/mobxjs/mobx/issues/1258)
|
|
480
|
+
- Fixed weird exception abot not being able to read `length` property of a function, see[#1238](https://github.com/mobxjs/mobx/issues/1238) through [#1257](https://github.com/mobxjs/mobx/issues/1238) by @dannsam
|
|
224
481
|
|
|
225
482
|
# 3.3.2
|
|
226
483
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
484
|
+
- Fix bug where custom comparers could be invoked with `undefined` values. Fixes [#1208](https://github.com/mobxjs/mobx/issues/1208)
|
|
485
|
+
- Make typings for observable stricter when using flow [#1194](https://github.com/mobxjs/mobx/issues/1194), [#1231](https://github.com/mobxjs/mobx/issues/1231)
|
|
486
|
+
- Fix a bug where `map.replace` would trigger reactions for unchanged values, fixes [#1243](https://github.com/mobxjs/mobx/issues/1243)
|
|
487
|
+
- Fixed issue where `NaN` was considered unequal to `NaN` when a deep compare was made [#1249](https://github.com/mobxjs/mobx/issues/1249)
|
|
231
488
|
|
|
232
489
|
# 3.3.1
|
|
233
490
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
491
|
+
- Fix bug allowing maps to be modified outside actions when using strict mode, fixes [#940](https://github.com/mobxjs/mobx/issues/940)
|
|
492
|
+
- Fixed [#1139](https://github.com/mobxjs/mobx/issues/1139) properly: `transaction` is no longer deprecated and doesn't disable tracking properties anymore
|
|
493
|
+
- Fixed [#1120](https://github.com/mobxjs/mobx/issues/1139): `isComputed` should return false for non-existing properties
|
|
237
494
|
|
|
238
495
|
# 3.3.0
|
|
239
496
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
497
|
+
- Undeprecated `transaction`, see [#1139](https://github.com/mobxjs/mobx/issues/1139)
|
|
498
|
+
- Fixed typings of reaction [#1136](https://github.com/mobxjs/mobx/issues/1136)
|
|
499
|
+
- It is now possible to re-define a computed property [#1121](https://github.com/mobxjs/mobx/issues/1121)
|
|
500
|
+
- Print an helpful error message when using `@action` on a getter [#971](https://github.com/mobxjs/mobx/issues/971)
|
|
501
|
+
- Improved typings of intercept [#1119](https://github.com/mobxjs/mobx/issues/1119)
|
|
502
|
+
- Made code base Prettier [#1103](https://github.com/mobxjs/mobx/issues/1103)
|
|
503
|
+
- react-native will now by default use the es module build as well.
|
|
504
|
+
- Added support for Weex, see [#1163](https://github.com/mobxjs/mobx/pull/1163/)
|
|
505
|
+
- Added workaround for Firefox issue causing MobX to crash, see [#614](https://github.com/mobxjs/mobx/issues/614)
|
|
249
506
|
|
|
250
507
|
# 3.2.2
|
|
251
508
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
509
|
+
- Fixes a bug (or a known limitation) described in [#1092](https://github.com/mobxjs/mobx/issue/1092/). It is now possible to have different observable administration on different levels of the prototype chain. By @guillaumeleclerc
|
|
510
|
+
- Fixed a build issue when using mobx in a project that was using rollup, fixes [#1099](https://github.com/mobxjs/mobx/issue/1099/) by @rossipedia
|
|
511
|
+
- Fixed typings of `useStrict`, by @rickbeerendonk
|
|
255
512
|
|
|
256
513
|
# 3.2.1
|
|
257
514
|
|
|
258
|
-
|
|
515
|
+
- Introduced customizable value comperators to reactions and computed values. `reaction` and `computed` now support an additional option, `equals`, which takes a comparision function. See [#951](https://github.com/mobxjs/mobx/pull/951/) by @jamiewinder. Fixes #802 and #943. See the updated [`computed` docs](https://mobx.js.org/refguide/computed-decorator.html) for more details.
|
|
259
516
|
|
|
260
517
|
# 3.2.0
|
|
261
518
|
|
|
262
|
-
|
|
519
|
+
- MobX will warn again when there are multiple instances of MobX loaded, as this lead to often to confusing bugs if the project setup was not properly. The signal mobx that multiple instances are loaded on purpose, use `mobx.extras.runInSandbox`. See [#1082](https://github.com/mobxjs/mobx/issues/1082) for details.
|
|
263
520
|
|
|
264
521
|
# 3.1.17
|
|
265
522
|
|
|
266
|
-
|
|
267
|
-
|
|
523
|
+
- Improved typings of `IObservableArray.intercept`: use more restrictive types for `change` parameter of `handler`, by @bvanreeven
|
|
524
|
+
- Fixed [#1072](https://github.com/mobxjs/mobx/issues/1072), fields without a default value could not be observed yet when using TypeScript
|
|
268
525
|
|
|
269
526
|
# 3.1.16
|
|
270
527
|
|
|
271
|
-
|
|
272
|
-
|
|
528
|
+
- Restored `default` export (and added warning), which broke code that was importing mobx like `import mobx from "mobx"`. Use `import * as mobx from "mobx"` or use named importes instead. By @andykog, see #1043, #1050
|
|
529
|
+
- Fixed several typos in exceptions and documentation
|
|
273
530
|
|
|
274
531
|
# 3.1.15
|
|
275
532
|
|
|
276
|
-
|
|
533
|
+
- Fixed issue where `array.remove` did not work correctly in combination with `extras.interceptReads`
|
|
277
534
|
|
|
278
535
|
# 3.1.14
|
|
279
536
|
|
|
280
|
-
|
|
537
|
+
- Fixed 3.1.12 / 3.1.13 module packing. See #1039; `module` target is now transpiled to ES5 as well
|
|
281
538
|
|
|
282
539
|
# 3.1.13 (Unpublished: Uglify chokes on it in CRA)
|
|
283
540
|
|
|
284
|
-
|
|
541
|
+
- Fixed build issue with webpack 2, see #1040
|
|
285
542
|
|
|
286
543
|
# 3.1.12 (Unpublished: wasn't being bundled correctly by all bundlers)
|
|
287
544
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
545
|
+
- Added support for ES modules. See #1027 by @rossipedia
|
|
546
|
+
- Improved flow typings. See #1019 by @fb55
|
|
547
|
+
- Introduced experimental feature `extras.interceptReads(observable: ObservableMap | ObservableArray | ObservableObject | ObservableBox, property?: string, handler: value => value): Disposer` that can be used to intercept _reads_ from observable objects, to transform values on the fly when a value is read. One can achieve similar things with this as with proxying reads. See #1036
|
|
291
548
|
|
|
292
549
|
# 3.1.11
|
|
293
550
|
|
|
294
|
-
|
|
551
|
+
- Using rollup as bundler, instead of custom hacked build scripts, by @rossipedia, see #1023
|
|
295
552
|
|
|
296
553
|
# 3.1.10
|
|
297
554
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
555
|
+
- Fixed flow typings for `when`, by @jamsea
|
|
556
|
+
- Add flow typings for `map.replace`, by @leader22
|
|
557
|
+
- Added `observableArray.findIndex`, by @leader22
|
|
558
|
+
- Improved typings of `autorun` / `autorunAsync` to better support async / await, by @capaj
|
|
559
|
+
- Fixed typings of `action.bound`, see #803
|
|
303
560
|
|
|
304
561
|
# 3.1.9
|
|
305
562
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
563
|
+
- Introduced explicit `.get(index)` and `.set(index, value)` methods on observable arrays, for issues that have trouble handling many property descriptors on objects. See also #734
|
|
564
|
+
- Made sure it is safe to call `onBecomeObserved` twice in row, fixes #874, #898
|
|
565
|
+
- Fixed typings of `IReactionDisposer`
|
|
309
566
|
|
|
310
567
|
# 3.1.8
|
|
311
568
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
569
|
+
- Fixed edge case where `autorun` was not triggered again if a computed value was invalidated by the reaction itself, see [#916](https://github.com/mobxjs/mobx/issues/916), by @andykog
|
|
570
|
+
- Added support for primtive keys in `createTransformer`, See #920 by @dnakov
|
|
571
|
+
- Improved typings of `isArrayLike`, see #904, by @mohsen1
|
|
315
572
|
|
|
316
573
|
# 3.1.7
|
|
317
574
|
|
|
318
|
-
|
|
575
|
+
- Reverted ES2015 module changes, as they broke with webpack 2 (will be re-released later)
|
|
319
576
|
|
|
320
577
|
# 3.1.6 (Unpublished)
|
|
321
578
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
579
|
+
- Expose ES2015 modules to be used with advanced bundlers, by @mohsen1, fixes #868
|
|
580
|
+
- Improved typings of `IObservableArray.intercept`: remove superflous type parameter, by @bvanreeven
|
|
581
|
+
- Improved typings of map changes, by @hediet
|
|
325
582
|
|
|
326
583
|
# 3.1.5
|
|
327
584
|
|
|
328
|
-
|
|
329
|
-
|
|
585
|
+
- Improved typings of map changes, see #847, by @hediet
|
|
586
|
+
- Fixed issue with `reaction` if `fireImmediately` was combined with `delay` option, see #837, by @SaboteurSpk
|
|
330
587
|
|
|
331
588
|
# 3.1.4
|
|
332
589
|
|
|
333
|
-
|
|
590
|
+
- Observable maps initialized from ES6 didn't deeply convert their values to observables. (fixes #869,by @ggarek)
|
|
334
591
|
|
|
335
592
|
# 3.1.3
|
|
336
593
|
|
|
337
|
-
|
|
338
|
-
|
|
594
|
+
- Make sure that `ObservableArray.replace` can handle large arrays by not using splats internally. (See e.g. #859)
|
|
595
|
+
- Exposed `ObservableArray.spliceWithArray`, that unlike a normal splice, doesn't use a variadic argument list so that it is possible to splice in new arrays that are larger then allowed by the callstack.
|
|
339
596
|
|
|
340
597
|
# 3.1.2
|
|
341
598
|
|
|
342
|
-
|
|
599
|
+
- Fixed incompatiblity issue with `mobx-react@4.1.0`
|
|
343
600
|
|
|
344
601
|
# 3.1.1 (unpublished)
|
|
345
602
|
|
|
346
|
-
|
|
603
|
+
- Introduced `isBoxedObservable(value)`, fixes #804
|
|
347
604
|
|
|
348
605
|
# 3.1.0
|
|
349
606
|
|
|
@@ -351,8 +608,8 @@ The issues are incoprorated in the above notes.
|
|
|
351
608
|
|
|
352
609
|
Strict mode has been relaxed a bit in this release. Also computed values can now better handle creating new observables (in an action if needed). The semantics are now as follows:
|
|
353
610
|
|
|
354
|
-
|
|
355
|
-
|
|
611
|
+
- In strict mode, it is not allowed to modify state that is already being _observed_ by some reaction.
|
|
612
|
+
- It is allowed to create and modify observable values in computed blocks, as long as they are not _observed_ yet.
|
|
356
613
|
|
|
357
614
|
In order words: Observables that are not in use anywhere yet, are not protected by MobX strict mode.
|
|
358
615
|
This is fine as the main goal of strict mode is to avoid kicking of reactions at undesired places.
|
|
@@ -360,42 +617,44 @@ Also strict mode enforces batched mutations of observables (through action).
|
|
|
360
617
|
However, for unobserved observables this is not relevant; they won't kick of reactions at all.
|
|
361
618
|
|
|
362
619
|
This fixes some uses cases where one now have to jump through hoops like:
|
|
363
|
-
|
|
364
|
-
|
|
620
|
+
|
|
621
|
+
- Creating observables in computed properties was fine already, but threw if this was done with the aid of an action. See issue [#798](https://github.com/mobxjs/mobx/issues/798).
|
|
622
|
+
- In strict mode, it was not possible to _update_ observable values without wrapping the code in `runInAction` or `action`. See issue [#563](https://github.com/mobxjs/mobx/issues/563)
|
|
365
623
|
|
|
366
624
|
Note that the following constructions are still anti patterns, although MobX won't throw anymore on them:
|
|
367
|
-
* Changing unobserved, but not just created observables in a computed value
|
|
368
|
-
* Invoke actions in computed values. Use reactions like `autorun` or `reaction` instead.
|
|
369
625
|
|
|
370
|
-
|
|
626
|
+
- Changing unobserved, but not just created observables in a computed value
|
|
627
|
+
- Invoke actions in computed values. Use reactions like `autorun` or `reaction` instead.
|
|
628
|
+
|
|
629
|
+
Note that observables that are not in use by a reaction, but that have `.observe` listeners attached, do _not_ count towards being observed.
|
|
371
630
|
Observe and intercept callbacks are concepts that do not relate to strict mode, actions or transactions.
|
|
372
631
|
|
|
373
632
|
### Other changes
|
|
374
633
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
634
|
+
- Reactions and observable values now consider `NaN === NaN`, See #805 by @andykog
|
|
635
|
+
- Merged #783: extract error messages to seperate file, so that they can be optimized in production builds (not yet done), by @reisel, #GoodnessSquad
|
|
636
|
+
- Improved typings of actions, see #796 by @mattiamanzati
|
|
378
637
|
|
|
379
638
|
# 3.0.2
|
|
380
639
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
640
|
+
- Fixed issue where MobX failed on environments where `Map` is not defined, #779 by @dirtyrolf
|
|
641
|
+
- MobX can now be compiled on windows as well! #772 by @madarauchiha #GoodnessSquad
|
|
642
|
+
- Added documentation on how Flow typings can be used, #766 by @wietsevenema
|
|
643
|
+
- Added support for `Symbol.toPrimitive()` and `valueOf()`, see #773 by @eladnava #GoodnessSquad
|
|
644
|
+
- Supressed an exception that was thrown when using the Chrome Developer tools to inspect arrays, see #752
|
|
386
645
|
|
|
387
646
|
Re-introduced _structural comparison_. Seems we couldn't part from it yet :). So the following things have been added:
|
|
388
647
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
648
|
+
- `struct` option to `reaction` (alias for `compareStructural`, to get more consistency in naming)
|
|
649
|
+
- `observable.struct`, as alias for `observable.deep.struct`
|
|
650
|
+
- `observable.deep.struct`: Only stores a new value and notify observers if the new value is not structurally the same as the previous value. Beware of cycles! Converts new values automatically to observables (like `observable.deep`)
|
|
651
|
+
- `observable.ref.struct`: Only stores a new value and notify observers if the new value is not structurally the same as the previous value. Beware of cycles! Doesn't convert the new value into observables.
|
|
652
|
+
- `extras.deepEquals`: Check if two data structures are deeply equal. supports observable and non observable data structures.
|
|
394
653
|
|
|
395
654
|
# 3.0.1
|
|
396
655
|
|
|
397
|
-
|
|
398
|
-
|
|
656
|
+
- `toString()` of observable arrays now behaves like normal arrays (by @capaj, see #759)
|
|
657
|
+
- Improved flow types of `toJS`by @jamsea (#758)
|
|
399
658
|
|
|
400
659
|
# 3.0.0
|
|
401
660
|
|
|
@@ -409,7 +668,7 @@ Note that no changes to the runtime algorithm where made, almost all changes evo
|
|
|
409
668
|
|
|
410
669
|
The api to create observables has been redesigned.
|
|
411
670
|
By default, it keeps the automatic conversion behavior from MobX 2.
|
|
412
|
-
However, one can now have more fine grained control on how
|
|
671
|
+
However, one can now have more fine grained control on how / which observables are constructed.
|
|
413
672
|
Modifiers still exists, but they are more regular, and there should be less need for them.
|
|
414
673
|
|
|
415
674
|
### `observable(plainObject)` will no longer enhance objects, but clone instead
|
|
@@ -433,11 +692,11 @@ See [#649](https://github.com/mobxjs/mobx/issues/649)
|
|
|
433
692
|
|
|
434
693
|
There are now explicit methods to create an observable of a specific type.
|
|
435
694
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
695
|
+
- `observable.object(props, name?)` creates a new observable object, by cloning the give props and making them observable
|
|
696
|
+
- `observable.array(initialValues, name?)`. Take a guess..
|
|
697
|
+
- `observable.map(initialValues, name?)`
|
|
698
|
+
- `observable.box(initialValue, name?)`. Creates a [boxed](http://mobxjs.github.io/mobx/refguide/boxed.html) value, which can be read from / written to using `.get()` and `.set(newValue)`
|
|
699
|
+
- `observable(value)`, as-is, based on the type of `value`, uses any of the above four functions to create a new observable.
|
|
441
700
|
|
|
442
701
|
### Shallow factories per type
|
|
443
702
|
|
|
@@ -447,10 +706,10 @@ For example when storing objects from external libraries.
|
|
|
447
706
|
In MobX 2 you needed to use `asFlat` or `asReference` modifiers for this.
|
|
448
707
|
In MobX 3, there are factories to directly create non-converting data structures:
|
|
449
708
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
709
|
+
- `observable.shallowObject(props, name?)`
|
|
710
|
+
- `observable.shallowArray(initialValues, name?)`
|
|
711
|
+
- `observable.shallowMap(initialValues, name?)`
|
|
712
|
+
- `observable.shallowBox(initialValue, name?)`
|
|
454
713
|
|
|
455
714
|
So for example, `observable.shallowArray([todo1, todo2])` will create an observable array, but it won't try to convert the todos inside the array into observables as well.
|
|
456
715
|
|
|
@@ -474,9 +733,9 @@ Modifiers can be used in combination `@observable`, `extendObservable` and `obse
|
|
|
474
733
|
|
|
475
734
|
The following modifiers are available:
|
|
476
735
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
736
|
+
- `observable.deep`: This is the default modifier, used by any observable. It converts any assigned, non-primitive value into an observable value if it isn't one yet.
|
|
737
|
+
- `observable.ref`: Disables automatic observable conversion, just creates an observable reference instead.
|
|
738
|
+
- `observable.shallow`: Can only used in combination with collections. Turns any assigned collection into an collection, which is shallowly observable (instead of deep)
|
|
480
739
|
|
|
481
740
|
Modifiers can be used as decorator:
|
|
482
741
|
|
|
@@ -500,24 +759,25 @@ See [modifiers](http://mobxjs.github.io/mobx/refguide/modifiers.html)
|
|
|
500
759
|
### `computed` api has been simplified
|
|
501
760
|
|
|
502
761
|
Using `computed` to create boxed observables has been simplified, and `computed` can now be invoked as follows:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
762
|
+
|
|
763
|
+
- `computed(expr)`
|
|
764
|
+
- `computed(expr, setter)`
|
|
765
|
+
- `computed(expr, options)`, where options is an object that can specify one or more of the following fields: `name`, `setter`, `compareStructural` or `context` (the "this").
|
|
506
766
|
|
|
507
767
|
Computed can also be used as a decorator:
|
|
508
768
|
|
|
509
|
-
|
|
510
|
-
|
|
769
|
+
- `@computed`
|
|
770
|
+
- `@computed.struct` when you want to compareStructural (previously was `@computed({asStructure: true})`)
|
|
511
771
|
|
|
512
772
|
### `reaction` api has been simplified
|
|
513
773
|
|
|
514
774
|
The signature of `reaction` is now `reaction(dataFunc, effectFunc, options?)`, where the following options are accepted:
|
|
515
775
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
776
|
+
- `context`: The `this` to be used in the functions
|
|
777
|
+
- `fireImmediately`
|
|
778
|
+
- `delay`: Number in milliseconds that can be used to debounce the effect function.
|
|
779
|
+
- `compareStructural`: `false` by default. If `true`, the return value of the _data_ function is structurally compared to its previous return value, and the _effect_ function will only be invoked if there is a structural change in the output.
|
|
780
|
+
- `name`: String
|
|
521
781
|
|
|
522
782
|
### Bound actions
|
|
523
783
|
|
|
@@ -526,12 +786,12 @@ This means that now the following is possible:
|
|
|
526
786
|
|
|
527
787
|
```javascript
|
|
528
788
|
class Ticker {
|
|
529
|
-
|
|
789
|
+
@observable tick = 0
|
|
530
790
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
791
|
+
@action.bound
|
|
792
|
+
increment() {
|
|
793
|
+
this.tick++ // 'this' will always be correct
|
|
794
|
+
}
|
|
535
795
|
}
|
|
536
796
|
|
|
537
797
|
const ticker = new Ticker()
|
|
@@ -543,10 +803,10 @@ setInterval(ticker.increment, 1000)
|
|
|
543
803
|
Error handling in MobX has been made more consistent. In MobX 2 there was a best-effort recovery attempt if a derivation throws, but MobX 3 introduced
|
|
544
804
|
more consistent behavior:
|
|
545
805
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
806
|
+
- Computed values that throw, store the exception and throw it to the next consumer(s). They keep tracking their data, so they are able to recover from exceptions in next re-runs.
|
|
807
|
+
- Reactions (like `autorun`, `when`, `reaction`, `render()` of `observer` components) will always catch their exceptions, and just log the error. They will keep tracking their data, so they are able to recover in next re-runs.
|
|
808
|
+
- The disposer of a reaction exposes an `onError(handler)` method, which makes it possible to attach custom error handling logic to an reaction (that overrides the default logging behavior).
|
|
809
|
+
- `extras.onReactionError(handler)` can be used to register a global onError handler for reactions (will fire after spy "error" event). This can be useful in tests etc.
|
|
550
810
|
|
|
551
811
|
See [#731](https://github.com/mobxjs/mobx/issues/731)
|
|
552
812
|
|
|
@@ -567,10 +827,10 @@ Add flow types for methods and interfaces of observable variables:
|
|
|
567
827
|
|
|
568
828
|
```js
|
|
569
829
|
const observableValue: IObservableValue<number> = observable(1)
|
|
570
|
-
const observableArray: IObservableArray<number> = observable([1,2,3])
|
|
830
|
+
const observableArray: IObservableArray<number> = observable([1, 2, 3])
|
|
571
831
|
|
|
572
832
|
const sum: IComputedValue<number> = computed(() => {
|
|
573
|
-
|
|
833
|
+
return observableArray.reduce((a: number, b: number): number => a + b, 0)
|
|
574
834
|
})
|
|
575
835
|
```
|
|
576
836
|
|
|
@@ -593,29 +853,35 @@ Since this behavior is probably not used outside Mendix, it has been deprecated
|
|
|
593
853
|
|
|
594
854
|
See [#621](https://github.com/mobxjs/mobx/issues/621)
|
|
595
855
|
|
|
856
|
+
### Using the @action decorator inside individual objects
|
|
857
|
+
|
|
858
|
+
Don't use the `@action` decorator on an individual object that you pass to `observable()` or `extendObservable()`. If you have code that looks like `observable({ @action f: () => {})`, you should change it to `observable({ f: action(() => {})`.
|
|
859
|
+
|
|
860
|
+
Whether or not this was ever a good idea is debatable, but it stopped working in this version. If you're using classes, it's a non-issue.
|
|
861
|
+
|
|
596
862
|
### Other changes
|
|
597
863
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
864
|
+
- **Breaking change:** The arguments to `observe` listeners for computed and boxed observables have changed and are now consistent with the other apis. Instead of invoking the callback with `(newValue: T, oldValue: T)` they are now invoked with a single change object: `(change: {newValue: T, oldValue: T, object, type: "update"})`
|
|
865
|
+
- Using transaction is now deprecated, use `action` or `runInAction` instead. Transactions now will enter an `untracked` block as well, just as actions, which removes the conceptual difference.
|
|
866
|
+
- Upgraded to typescript 2
|
|
867
|
+
- It is now possible to pass ES6 Maps to `observable` / observable maps. The map will be converted to an observable map (if keys are string like)
|
|
868
|
+
- Made `action` more debug friendly, it should now be easier to step through
|
|
869
|
+
- ObservableMap now has an additional method, `.replace(data)`, which is a combination of `clear()` and `merge(data)`.
|
|
870
|
+
- Passing a function to `observable` will now create a boxed observable refering to that function
|
|
871
|
+
- Fixed #603: exceptions in transaction breaks future reactions
|
|
872
|
+
- Fixed #698: createTransformer should support default arguments
|
|
873
|
+
- Transactions are no longer reported grouped in spy events. If you want to group events, use actions instead.
|
|
874
|
+
- Normalized `spy` events further. Computed values and actions now report `object` instead of `target` for the scope they have been applied to.
|
|
875
|
+
- The following deprecated methods have been removed:
|
|
876
|
+
- `transaction`
|
|
877
|
+
- `autorunUntil`
|
|
878
|
+
- `trackTransitions`
|
|
879
|
+
- `fastArray`
|
|
880
|
+
- `SimpleEventEmitter`
|
|
881
|
+
- `ObservableMap.toJs` (use `toJS`)
|
|
882
|
+
- `toJSlegacy`
|
|
883
|
+
- `toJSON` (use `toJS`)
|
|
884
|
+
- invoking `observe` and `inject` with plain javascript objects
|
|
619
885
|
|
|
620
886
|
---
|
|
621
887
|
|
|
@@ -627,9 +893,9 @@ A deprecation message will now be printed if creating computed properties while
|
|
|
627
893
|
|
|
628
894
|
```javascript
|
|
629
895
|
const x = observable({
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
896
|
+
computedProp: function() {
|
|
897
|
+
return someComputation
|
|
898
|
+
}
|
|
633
899
|
})
|
|
634
900
|
|
|
635
901
|
// Due to automatic inferrence now available as computed property:
|
|
@@ -642,9 +908,9 @@ Instead, to create a computed property, use:
|
|
|
642
908
|
|
|
643
909
|
```javascript
|
|
644
910
|
observable({
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
911
|
+
get computedProp() {
|
|
912
|
+
return someComputation
|
|
913
|
+
}
|
|
648
914
|
})
|
|
649
915
|
```
|
|
650
916
|
|
|
@@ -652,14 +918,14 @@ or alternatively:
|
|
|
652
918
|
|
|
653
919
|
```javascript
|
|
654
920
|
observable({
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
921
|
+
computedProp: computed(function() {
|
|
922
|
+
return someComputation
|
|
923
|
+
})
|
|
658
924
|
})
|
|
659
925
|
```
|
|
660
926
|
|
|
661
927
|
This change should avoid confusing experiences when trying to create methods that don't take arguments.
|
|
662
|
-
The current behavior will be kept as-is in the MobX 2
|
|
928
|
+
The current behavior will be kept as-is in the MobX 2.\* range,
|
|
663
929
|
but from MobX 3 onward the argumentless functions will no longer be turned
|
|
664
930
|
automatically into computed values; they will be treated the same as function with arguments.
|
|
665
931
|
An observable _reference_ to the function will be made and the function itself will be preserved.
|
|
@@ -669,10 +935,10 @@ N.B. If you want to introduce actions on an observable that modify its state, us
|
|
|
669
935
|
|
|
670
936
|
```javascript
|
|
671
937
|
observable({
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
938
|
+
counter: 0,
|
|
939
|
+
increment: action(function() {
|
|
940
|
+
this.counter++
|
|
941
|
+
})
|
|
676
942
|
})
|
|
677
943
|
```
|
|
678
944
|
|
|
@@ -690,74 +956,73 @@ Note, this only applies when using observable in this way; it doesn't apply when
|
|
|
690
956
|
|
|
691
957
|
### Misc
|
|
692
958
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
959
|
+
- Fixed #701: `toJS` sometimes failing to convert objects decorated with `@observable` (cause: `isObservable` sometimes returned false on these object)
|
|
960
|
+
- Fixed typings for `when` / `autorun` / `reaction`; they all return a disposer function.
|
|
696
961
|
|
|
697
962
|
# 2.6.5
|
|
698
963
|
|
|
699
|
-
|
|
964
|
+
- Added `move` operation to observable array, see [#697](https://github.com/mobxjs/mobx/pull/697)
|
|
700
965
|
|
|
701
966
|
# 2.6.4
|
|
702
967
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
968
|
+
- Fixed potential clean up issue if an exception was thrown from an intercept handler
|
|
969
|
+
- Improved typings of `asStructure` (by @nidu, see #687)
|
|
970
|
+
- Added support for `computed(asStructure(() => expr))` (by @yotambarzilay, see #685)
|
|
706
971
|
|
|
707
972
|
# 2.6.3
|
|
708
973
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
974
|
+
- Fixed #603: exceptions in transaction breaks future reactions
|
|
975
|
+
- Improved typings of `toJS`
|
|
976
|
+
- Introduced `setReactionScheduler`. Internal api used by mobx-react@4 to be notified when reactions will be run
|
|
712
977
|
|
|
713
978
|
# 2.6.2
|
|
714
979
|
|
|
715
|
-
|
|
980
|
+
- Changes related to `toJS` as mentioned in version `2.6.0` where not actually shipped. This has been fixed, so see release notes below.
|
|
716
981
|
|
|
717
982
|
# 2.6.1
|
|
718
983
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
984
|
+
- Introduced convenience `isArrayLike`: returns whether the argument is either a JS- or observable array. By @dslmeinte
|
|
985
|
+
- Improved readme. By @DavidLGoldberg
|
|
986
|
+
- Improved assertion message, by @ncammarate (See [#618](https://github.com/mobxjs/mobx/pull/618))
|
|
987
|
+
- Added HashNode badge, by @sandeeppanda92
|
|
723
988
|
|
|
724
989
|
# 2.6.0
|
|
725
990
|
|
|
726
991
|
_Marked as minor release as the behavior of `toJS` has been changed, which might be interpreted both as bug-fix or as breaking change, depending of how you interpreted the docs_
|
|
727
992
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
993
|
+
- Fixed [#566](https://github.com/mobxjs/mobx/pull/566): Fixed incorrect behavior of `toJS`: `toJS` will now only recurse into observable object, not all objects. The new behavior is now aligned with what is suggested in the docs, but as a result the semantics changed a bit. `toJSlegacy` will be around for a while implementing the old behavior. See [#589](See https://github.com/mobxjs/mobx/pull/589) for more details.
|
|
994
|
+
- Fixed [#571](https://github.com/mobxjs/mobx/pull/571): Don't use `instanceof` operator. Should fix issues if MobX is included multiple times in the same bundle.
|
|
995
|
+
- Fixed [#576](https://github.com/mobxjs/mobx/pull/576): disallow passing actions directly to `autorun`; as they won't be tracked by @jeffijoe
|
|
996
|
+
- Extending observable objects with other observable (objects) is now explicitly forbidden, fixes [#540](https://github.com/mobxjs/mobx/pull/540).
|
|
732
997
|
|
|
733
998
|
# 2.5.2
|
|
734
999
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
1000
|
+
- Introduced `isComputed`
|
|
1001
|
+
- Observable objects can now have a type: `IObservableObject`, see [#484](https://github.com/mobxjs/mobx/pull/484) by @spiffytech
|
|
1002
|
+
- Restored 2.4 behavior of boxed observables inside observable objects, see [#558](https://github.com/mobxjs/mobx/issues/558)
|
|
738
1003
|
|
|
739
1004
|
# 2.5.1
|
|
740
1005
|
|
|
741
|
-
|
|
1006
|
+
- Computed properties can now be created by using getter / setter functions. This is the idiomatic way to introduce computed properties from now on:
|
|
742
1007
|
|
|
743
1008
|
```javascript
|
|
744
1009
|
const box = observable({
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1010
|
+
length: 2,
|
|
1011
|
+
get squared() {
|
|
1012
|
+
return this.length * this.length
|
|
1013
|
+
},
|
|
1014
|
+
set squared(value) {
|
|
1015
|
+
this.length = Math.sqrt(value)
|
|
1016
|
+
}
|
|
752
1017
|
})
|
|
753
1018
|
```
|
|
754
1019
|
|
|
755
1020
|
# 2.5.0
|
|
756
1021
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1022
|
+
- Core derivation algorithm has received some majore improvements by @asterius1! See below. Pr #452, 489
|
|
1023
|
+
- Introduced setters for computed properties, use `computed(expr, setter)` or `@computed get name() { return expr } set name (value) { action }`. `computed` can now be used as modifier in `observable` / `extendObservable`, #421, #463 (see below for example)
|
|
1024
|
+
- Introduced `isStrictModeEnabled()`, deprecated `useStrict()` without arguments, see #464
|
|
1025
|
+
- Fixed #505, accessing an observable property throws before it is initialized
|
|
761
1026
|
|
|
762
1027
|
MobX is now able track and memoize computed values while an (trans)action is running.
|
|
763
1028
|
Before 2.5, accessing a computed value during a transaction always resulted in a recomputation each time the computed value was accessed, because one of the upstream observables (might) have changed.
|
|
@@ -766,123 +1031,128 @@ This means that computed values are now always memoized for the duration of the
|
|
|
766
1031
|
In specific cases, this might signficantly speed up actions that extensively make decisions based on computed values.
|
|
767
1032
|
|
|
768
1033
|
Example:
|
|
1034
|
+
|
|
769
1035
|
```javascript
|
|
770
1036
|
class Square {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1037
|
+
@observable length = 2
|
|
1038
|
+
@computed get squared() {
|
|
1039
|
+
return this.length * this.length
|
|
1040
|
+
}
|
|
1041
|
+
// mobx now supports setters for computed values
|
|
1042
|
+
set squared(surfaceSize) {
|
|
1043
|
+
this.length = Math.sqrt(surfaceSize)
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// core changes make actions more efficient if extensively using computed values:
|
|
1047
|
+
@action stuff() {
|
|
1048
|
+
this.length = 3
|
|
1049
|
+
console.log(this.squared) // recomputes in both 2.5 and before
|
|
1050
|
+
console.log(this.squared) // no longer recomputes
|
|
1051
|
+
this.length = 4
|
|
1052
|
+
console.log(this.squared) // recomputes in both 2.5 and before
|
|
1053
|
+
// after the action, before 2.5 squared would compute another time (if in use by a reaction), that is no longer the case
|
|
1054
|
+
}
|
|
789
1055
|
}
|
|
790
1056
|
```
|
|
791
1057
|
|
|
792
1058
|
ES5 example for setters:
|
|
1059
|
+
|
|
793
1060
|
```javascript
|
|
794
1061
|
function Square() {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
1062
|
+
extendObservable(this, {
|
|
1063
|
+
length: 2,
|
|
1064
|
+
squared: computed(
|
|
1065
|
+
function() {
|
|
1066
|
+
return this.squared * this.squared
|
|
1067
|
+
},
|
|
1068
|
+
function(surfaceSize) {
|
|
1069
|
+
this.length = Math.sqrt(surfaceSize)
|
|
1070
|
+
}
|
|
1071
|
+
)
|
|
1072
|
+
})
|
|
806
1073
|
}
|
|
807
1074
|
```
|
|
808
1075
|
|
|
809
1076
|
# 2.4.4
|
|
810
1077
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1078
|
+
- Fixed #503: map.delete returns boolean
|
|
1079
|
+
- Fix return type of `runInAction`, #499 by @Strate
|
|
1080
|
+
- Fixed enumerability of observable array methods, see #496.
|
|
1081
|
+
- Use TypeScript typeguards, #487 by @Strate
|
|
1082
|
+
- Added overloads to `action` for better type inference, #500 by @Strate
|
|
1083
|
+
- Fixed #502: `extendObservable` fails on objects created with `Object.create(null)`
|
|
1084
|
+
- Implemented #480 / #488: better typings for `asMap`, by @Strate
|
|
818
1085
|
|
|
819
1086
|
# 2.4.3
|
|
820
1087
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
1088
|
+
- Objects with a `null` prototype are now considered plain objects as well
|
|
1089
|
+
- Improved error message for non-converging cyclic reactions
|
|
1090
|
+
- Fixed potential HMR issue
|
|
824
1091
|
|
|
825
1092
|
# 2.4.2
|
|
826
1093
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1094
|
+
- Improved error message when wrongly using `@computed`, by @bb (#450)
|
|
1095
|
+
- `observableArray.slice` now automatically converts observable arrays to plain arrays, fixes #460
|
|
1096
|
+
- Improved error message when an uncaught exception is thrown by a MobX tracked function
|
|
830
1097
|
|
|
831
1098
|
# 2.4.1
|
|
832
1099
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1100
|
+
- `@action` decorated methods are now configurable. Fixes #441
|
|
1101
|
+
- The `onBecomeObserved` event handler is now triggered when an atom is observed, instead of when it is bound as dependency. Fixes #427 and makes atoms easier to extend.
|
|
1102
|
+
- if `useStrict()` is invoked without arguments, it now returns the current value of strict mode.
|
|
1103
|
+
- the current reaction is now always passed as first argument to the callbacks of `autorun`, `autorunAsync`, `when` and `reaction`. This allows reactions to be immediately disposed during the first run. See #438, by @andykog
|
|
837
1104
|
|
|
838
1105
|
# 2.4.0
|
|
839
1106
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1107
|
+
- _Note: the internal version of MobX has been bumped. This version has no breaking api changes, but if you have MobX loaded multiple times in your project, they all have to be upgraded to `2.4.0`. MobX will report this when starting._
|
|
1108
|
+
- Made dependency tracking and binding significant faster. Should result in huge performance improvements when working with large collections.
|
|
1109
|
+
- Fixed typescript decorator issue, #423, #425? (by @bb)
|
|
843
1110
|
|
|
844
1111
|
# 2.3.7
|
|
845
1112
|
|
|
846
|
-
|
|
1113
|
+
- Fixed issue where computed values were tracked and accidentally kept alive during actions
|
|
847
1114
|
|
|
848
1115
|
# 2.3.6
|
|
849
|
-
|
|
850
|
-
|
|
1116
|
+
|
|
1117
|
+
- Fixed #406: Observable maps doesn't work with empty initial value in Safari
|
|
1118
|
+
- Implemented #357, #348: ObservableMap and ObservableArray now support iterators. Use [`@@iterator()` or iterall](https://github.com/leebyron/iterall) in ES5 environments.
|
|
851
1119
|
|
|
852
1120
|
# 2.3.5
|
|
853
1121
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1122
|
+
- Fixed #364: Observable arrays not reacting properly to index assignments under iOS safari (mobile) 9.1.1 By @andykog
|
|
1123
|
+
- Fixed #387: Typings of boxed values
|
|
1124
|
+
- Added warning when reading array entries out of bounds. See #381
|
|
857
1125
|
|
|
858
1126
|
# 2.3.4
|
|
859
1127
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1128
|
+
- Fixed #360: Removed expensive cycle detection (cycles are still detected, but a bit later)
|
|
1129
|
+
- Fixed #377: `toJS` serialization of Dates and Regexes preserves the original values
|
|
1130
|
+
- Fixed #379: `@action` decorated methods can now be inherited / overriden
|
|
863
1131
|
|
|
864
1132
|
# 2.3.3
|
|
865
1133
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1134
|
+
- Fixed #186: Log a warning instead of an error if an exception is thrown in a derivation. Fixes issue where React Native would produce unusable error screens (because it shows the first logged error)
|
|
1135
|
+
- Fixed #333: Fixed some interoperability issues in combination with `Reflect` / `InversifyJS` decorators. @andykog
|
|
1136
|
+
- Fixed #333: `@observable` class properties are now _owned_ by their instance again, meaning they will show up in `Object.keys()` and `.hasOwnProperty` @andykog
|
|
869
1137
|
|
|
870
1138
|
# 2.3.2
|
|
871
1139
|
|
|
872
|
-
|
|
873
|
-
|
|
1140
|
+
- Fixed #328: Fixed exception when inspecting observable in `onBecomeObserved`
|
|
1141
|
+
- Fixed #341: `array.find` now returns `undefined` instead of `null` when nothing was found, behavior now matches the docs. (By @hellectronic)
|
|
874
1142
|
|
|
875
1143
|
# 2.3.1
|
|
876
1144
|
|
|
877
|
-
|
|
1145
|
+
- Fixed #327: spy not working with runInAction
|
|
878
1146
|
|
|
879
1147
|
# 2.3.0
|
|
880
1148
|
|
|
881
1149
|
### Introduced `whyRun`:
|
|
1150
|
+
|
|
882
1151
|
Usage:
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1152
|
+
|
|
1153
|
+
- `whyRun()`
|
|
1154
|
+
- `whyRun(Reaction object / ComputedValue object / disposer function)`
|
|
1155
|
+
- `whyRun(object, "computed property name")`
|
|
886
1156
|
|
|
887
1157
|
`whyRun` is a small utility that can be used inside computed value or reaction (`autorun`, `reaction` or the `render` method of an `observer` React component)
|
|
888
1158
|
and prints why the derivation is currently running, and under which circumstances it will run again.
|
|
@@ -891,120 +1161,123 @@ This should help to get a deeper understanding when and why MobX runs stuff, and
|
|
|
891
1161
|
This feature can probably be improved based on your feedback, so feel free to file issues with suggestions!
|
|
892
1162
|
|
|
893
1163
|
### Semantic changes:
|
|
894
|
-
|
|
895
|
-
|
|
1164
|
+
|
|
1165
|
+
- `@observable` is now always defined on the class prototypes and not in the instances. This means that `@observable` properties are enumerable, but won't appear if `Object.keys` or `hasOwnProperty` is used on a class _instance_.
|
|
1166
|
+
- Updated semantics of `reaction` as discussed in `#278`. The expression now needs to return a value and the side effect won't be triggered if the result didn't change. `asStructure` is supported in these cases. In contrast to MobX 2.2, effects will no longer be run if the output of the expression didn't change.
|
|
896
1167
|
|
|
897
1168
|
### Enhancements
|
|
898
1169
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1170
|
+
- Introduces `isAction(fn)` #290
|
|
1171
|
+
- If an (argumentless) action is passed to `observable` / `extendObservable`, it will not be converted into a computed property.
|
|
1172
|
+
- Fixed #285: class instances are now also supported by `toJS`. Also members defined on prototypes which are enumerable are converted.
|
|
1173
|
+
- Map keys are now always coerced to strings. Fixes #308
|
|
1174
|
+
- `when`, `autorun` and `autorunAsync` now accept custom debug names (see #293, by @jamiewinder)
|
|
1175
|
+
- Fixed #286: autoruns no longer stop working if an action throws an exception
|
|
1176
|
+
- Implemented `runInAction`, can be used to create on the fly actions (especially useful in combination with `async/await`, see #299
|
|
1177
|
+
- Improved performance and reduced mem usage of decorators signficantly (by defining the properties on the prototype if possible), and removed subtle differences between the implementation and behavior in babel and typescript.
|
|
1178
|
+
- Updated logo as per #244. Tnx @osenvosem!
|
|
908
1179
|
|
|
909
1180
|
# 2.2.2:
|
|
910
1181
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1182
|
+
- Fixed issue #267: exception when `useStrict(true)` was invoked in combination with `@observable` attributes when using Babel
|
|
1183
|
+
- Fixed issue #269: @action in combination with typescript targeting ES6 and reflect.ts
|
|
1184
|
+
- Improved compatibility with `JSON.stringify`, removed incorrect deprecation message
|
|
1185
|
+
- Improved some error messages
|
|
915
1186
|
|
|
916
1187
|
# 2.2.1
|
|
917
1188
|
|
|
918
|
-
|
|
919
|
-
|
|
1189
|
+
- Fixed issue where typescript threw a compile error when using `@action` without params on a field
|
|
1190
|
+
- Fixed issue where context was accidentally shared between class instances when using `@action` on a field
|
|
920
1191
|
|
|
921
1192
|
# 2.2.0
|
|
922
1193
|
|
|
923
1194
|
See the [release announcement](https://medium.com/@mweststrate/45cdc73c7c8d) for the full details of this release:
|
|
924
1195
|
|
|
925
1196
|
Introduced:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1197
|
+
|
|
1198
|
+
- `action` / `@action`
|
|
1199
|
+
- `intercept`
|
|
1200
|
+
- `spy`
|
|
1201
|
+
- `reaction`
|
|
1202
|
+
- `useStrict`
|
|
1203
|
+
- improved debug names
|
|
1204
|
+
- `toJSON` was renamed to `toJS`
|
|
1205
|
+
- `observable(asMap())` is the new idiomatic way to create maps
|
|
1206
|
+
- the effect of `when` is now untracked, similar to `reaction.
|
|
1207
|
+
- `extras.trackTransations` is deprecated, use `spy` instead
|
|
1208
|
+
- `untracked` has been undeprecated
|
|
1209
|
+
- introduced / documented: `getAtom`, `getDebugName`, `isSpyEnabled`, `spyReport`, `spyReportStart`, `spyReportEnd`
|
|
1210
|
+
- deprecated `extras.SimpleEventEmitter`
|
|
1211
|
+
- array splice events now also report the `added` collection and `removedCount`
|
|
940
1212
|
|
|
941
1213
|
# 2.1.7
|
|
942
1214
|
|
|
943
|
-
|
|
1215
|
+
- Fixed a false negative in cycle detection, as reported in #236
|
|
944
1216
|
|
|
945
1217
|
# 2.1.6
|
|
946
1218
|
|
|
947
|
-
|
|
1219
|
+
- Fixed #236, #237 call stack issues when working with large arrays
|
|
948
1220
|
|
|
949
1221
|
# 2.1.5
|
|
950
1222
|
|
|
951
|
-
|
|
1223
|
+
- Fix #222 (by @andykog) run `observe` callback of computed properties in untracked mode.
|
|
952
1224
|
|
|
953
1225
|
# 2.1.4
|
|
954
1226
|
|
|
955
|
-
|
|
1227
|
+
- Fixed #201 (see also #160), another iOS enumerability issue... By @luosong
|
|
956
1228
|
|
|
957
1229
|
# 2.1.3
|
|
958
1230
|
|
|
959
|
-
|
|
960
|
-
|
|
1231
|
+
- Fixed #191, when using babel, complex field initializers where shared. By @andykog
|
|
1232
|
+
- Added `lib/mobx.umd.min.js` for minified cdn builds, see #85
|
|
961
1233
|
|
|
962
1234
|
# 2.1.2
|
|
963
1235
|
|
|
964
|
-
|
|
965
|
-
|
|
1236
|
+
- Improved debug names of objects created using a constructor
|
|
1237
|
+
- Fixed(?) some issues with iOS7 as reported in #60 by @bstst
|
|
966
1238
|
|
|
967
1239
|
# 2.1.1
|
|
968
1240
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1241
|
+
- Fixed issue where `autorun`s created inside `autorun`s were not always kicked off. (`mobx-react`'s `observer` was not affected). Please upgrade if you often use autorun.
|
|
1242
|
+
- Fixed typings of `mobx.map`, a list of entries is also acceptable.
|
|
1243
|
+
- (Experimental) Improved error recovery a bit further
|
|
972
1244
|
|
|
973
1245
|
# 2.1.0
|
|
974
1246
|
|
|
975
|
-
|
|
976
|
-
|
|
1247
|
+
- MobX is now chatty again when an exception occurs inside a autorun / computed value / React.render. Previously this was considered to be the responsibility of the surrounding code. But if exceptions were eaten this would be really tricky to debug.
|
|
1248
|
+
- (Experimental) MobX will now do a poor attempt to recover from exceptions that occured in autorun / computed value / React.render.
|
|
977
1249
|
|
|
978
1250
|
# 2.0.6
|
|
979
1251
|
|
|
980
|
-
|
|
981
|
-
|
|
1252
|
+
- `resetGlobalState` is now part of the `mobx.extras` namespace, as it is useful for test setup, to restore inconsistent state after test failures.
|
|
1253
|
+
- `resetGlobalState` now also resets the caches of `createTransformer`, see #163.
|
|
982
1254
|
|
|
983
1255
|
# 2.0.5
|
|
984
1256
|
|
|
985
|
-
|
|
1257
|
+
- WIP on bower support
|
|
986
1258
|
|
|
987
1259
|
# 2.0.4
|
|
988
1260
|
|
|
989
|
-
|
|
1261
|
+
- `$transformId` property on transformed objects should be non-enumerable. Fixes #170.
|
|
990
1262
|
|
|
991
1263
|
# 2.0.3
|
|
992
1264
|
|
|
993
|
-
|
|
1265
|
+
- Always peek if inspecting a stale, computed value. Fixes #165.
|
|
994
1266
|
|
|
995
1267
|
# 2.0.2
|
|
996
1268
|
|
|
997
|
-
|
|
1269
|
+
- Fixed issue where changing an object property was tracked, which could lead to unending loops in `autorunAsync`.
|
|
998
1270
|
|
|
999
1271
|
# 2.0.1
|
|
1000
1272
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1273
|
+
- Undeprecated `observable(scalar)` (see 143)
|
|
1274
|
+
- `expr` no longer prints incorrect deprecated messages (see 143)
|
|
1275
|
+
- Requires `mobx` twice no longer fails.
|
|
1004
1276
|
|
|
1005
1277
|
# 2.0.0
|
|
1006
1278
|
|
|
1007
1279
|
## A new name...
|
|
1280
|
+
|
|
1008
1281
|
Welcome to ~Mobservable~ MobX 2! First of all, there is the name change.
|
|
1009
1282
|
The new name is shorter and funnier and it has the right emphasis: MobX is about reactive programming.
|
|
1010
1283
|
Not about observability of data structures, which is just a technical necessity.
|
|
@@ -1021,6 +1294,7 @@ Besides that, MobX is just a large collection of minor improvements over Mobserv
|
|
|
1021
1294
|
Make sure to remove your old `mobservable` dependencies when installing the new `mobx` dependencies!
|
|
1022
1295
|
|
|
1023
1296
|
## `autorun`s are now allowed to cause cycles!
|
|
1297
|
+
|
|
1024
1298
|
`autorun` is now allowed to have cycles. In Mobservable 1 an exception was thrown as soon as an autorun modified a variable which it was reading as well.
|
|
1025
1299
|
In MobX 2 these situations are now allowed and the autorun will trigger itself to be fired again immediately after the current execution.
|
|
1026
1300
|
This is fine as long as the autorun terminates within a reasonable amount of iterations (100).
|
|
@@ -1033,10 +1307,11 @@ Creating an observable from a primitive or a reference no longer returns a gette
|
|
|
1033
1307
|
This is less confusing, easier to debug and more efficient.
|
|
1034
1308
|
|
|
1035
1309
|
So to read or write from an observable scalar use:
|
|
1310
|
+
|
|
1036
1311
|
```javascript
|
|
1037
|
-
const temperature =
|
|
1038
|
-
temperature.set(15)
|
|
1039
|
-
temperature.get()
|
|
1312
|
+
const temperature = observable(27)
|
|
1313
|
+
temperature.set(15) // previously: temperature(15)
|
|
1314
|
+
temperature.get() // previously: temperature()
|
|
1040
1315
|
```
|
|
1041
1316
|
|
|
1042
1317
|
`observable(scalar)` has been deprecated to make the api smaller and the syntax more uniform. In practice having observable objects, arrays and decorators seems to suffice in 99% of the cases. Deprecating this functionality means that people have simply less concepts to learn. Probably creating observable scalars will continue to work for a long time, as it is important to the internals of MobX and very convenient for testing.
|
|
@@ -1066,90 +1341,90 @@ In MobX 2 it is no longer allowed for a computed function or `autorun` to throw
|
|
|
1066
1341
|
|
|
1067
1342
|
## Improved build
|
|
1068
1343
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1344
|
+
- MobX is roughly 20% faster
|
|
1345
|
+
- MobX is smaller: 75KB -> 60KB unminified, and 54KB -> 30KB minified.
|
|
1346
|
+
- Distributable builds are no longer available in the git repository, use unpkg instead:
|
|
1347
|
+
- Commonjs build: https://unpkg.com/mobx@^2.0.0/lib/mobx.js
|
|
1348
|
+
- Minified commonjs build: https://unpkg.com/mobx@^2.0.0/lib/mobx.min.js
|
|
1349
|
+
- UMD build: https://unpkg.com/mobx@^2.0.0/lib/mobx.umd.js
|
|
1350
|
+
- To use the minified build, require / import the lib from `"mobx/lib/mobx.min.js"` (or set up an alias in your webpack configuration if applicable)
|
|
1076
1351
|
|
|
1077
1352
|
## Other changes
|
|
1078
1353
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1354
|
+
- Improved debug names of all observables. This is especially visible when using `mobx-react-devtools` or `extras.trackTransitions`.
|
|
1355
|
+
- Renamed `extras.SimpleEventEmitter` to `SimpleEventEmitter`
|
|
1356
|
+
- Removed already deprecated methods: `isReactive`, `makeReactive`, `observeUntil`, `observeAsync`
|
|
1357
|
+
- Removed `extras.getDNode`
|
|
1358
|
+
- Invoking `ObservableArray.peek` is no longer registered as listener
|
|
1359
|
+
- Deprecated `untracked`. It wasn't documented and nobody seems to miss it.
|
|
1085
1360
|
|
|
1086
1361
|
# 1.2.5
|
|
1087
1362
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1363
|
+
- Map no longer throws when `.has`, `.get` or `.delete` is invoked with an invalid key (#116)
|
|
1364
|
+
- Files are now compiled without sourcemap to avoid issues when loading mobservable in a debugger when `src/` folder is not available.
|
|
1090
1365
|
|
|
1091
1366
|
# 1.2.4
|
|
1092
1367
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1368
|
+
- Fixed: observable arrays didn't properly apply modifiers if created using `asFlat([])` or `fastArray([])`
|
|
1369
|
+
- Don't try to make frozen objects observable (by @andykog)
|
|
1370
|
+
- `observableArray.reverse` no longer mutates the arry but just returns a sorted copy
|
|
1371
|
+
- Updated tests to use babel6
|
|
1097
1372
|
|
|
1098
1373
|
# 1.2.3
|
|
1099
1374
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1375
|
+
- observableArray.sort no longer mutates the array being sorted but returns a sorted clone instead (#90)
|
|
1376
|
+
- removed an incorrect internal state assumption (#97)
|
|
1102
1377
|
|
|
1103
1378
|
# 1.2.2
|
|
1104
1379
|
|
|
1105
|
-
|
|
1380
|
+
- Add bower support
|
|
1106
1381
|
|
|
1107
1382
|
# 1.2.1
|
|
1108
1383
|
|
|
1109
|
-
|
|
1384
|
+
- Computed value now yields consistent results when being inspected while in transaction
|
|
1110
1385
|
|
|
1111
1386
|
# 1.2.0
|
|
1112
1387
|
|
|
1113
|
-
|
|
1388
|
+
- Implemented #67: Reactive graph transformations. See: http://mobxjs.github.io/mobservable/refguide/create-transformer.html
|
|
1114
1389
|
|
|
1115
1390
|
# 1.1.8
|
|
1116
1391
|
|
|
1117
|
-
|
|
1392
|
+
- Implemented #59, `isObservable` and `observe` now support a property name as second param to observe individual values on maps and objects.
|
|
1118
1393
|
|
|
1119
1394
|
# 1.1.7
|
|
1120
1395
|
|
|
1121
|
-
|
|
1396
|
+
- Fixed #77: package consumers with --noImplicitAny should be able to build
|
|
1122
1397
|
|
|
1123
1398
|
# 1.1.6
|
|
1124
1399
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1400
|
+
- Introduced `mobservable.fastArray(array)`, in addition to `mobservable.observable(array)`. Which is much faster when adding items but doesn't support enumerability (`for (var idx in ar) ..` loops).
|
|
1401
|
+
- Introduced `observableArray.peek()`, for fast access to the array values. Should be used read-only.
|
|
1127
1402
|
|
|
1128
1403
|
# 1.1.5
|
|
1129
1404
|
|
|
1130
|
-
|
|
1405
|
+
- Fixed 71: transactions should not influence running computations
|
|
1131
1406
|
|
|
1132
1407
|
# 1.1.4
|
|
1133
1408
|
|
|
1134
|
-
|
|
1409
|
+
- Fixed #65; illegal state exception when using a transaction inside a reactive function. Credits: @kmalakoff
|
|
1135
1410
|
|
|
1136
1411
|
# 1.1.3
|
|
1137
1412
|
|
|
1138
|
-
|
|
1413
|
+
- Fixed #61; if autorun was created during a transaction, postpone execution until the end of the transaction
|
|
1139
1414
|
|
|
1140
1415
|
# 1.1.2
|
|
1141
1416
|
|
|
1142
|
-
|
|
1417
|
+
- Fixed exception when autorunUntil finished immediately
|
|
1143
1418
|
|
|
1144
1419
|
# 1.1.1
|
|
1145
1420
|
|
|
1146
|
-
|
|
1421
|
+
- `toJSON` now serializes object trees with cycles as well. If you know the object tree is acyclic, pass in `false` as second parameter for a performance gain.
|
|
1147
1422
|
|
|
1148
1423
|
# 1.1.0
|
|
1149
1424
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1425
|
+
- Exposed `ObservableMap` type
|
|
1426
|
+
- Introduced `mobservable.untracked(block)`
|
|
1427
|
+
- Introduced `mobservable.autorunAsync(block, delay)`
|
|
1153
1428
|
|
|
1154
1429
|
# 1.0.9
|
|
1155
1430
|
|
|
@@ -1165,113 +1440,113 @@ Fix incompatibility issue with systemjs bundler (see PR 52)
|
|
|
1165
1440
|
|
|
1166
1441
|
# 1.0.4/5
|
|
1167
1442
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1443
|
+
- `map.size` is now a property instead of a function
|
|
1444
|
+
- `map()` now accepts an array as entries to construct the new map
|
|
1445
|
+
- introduced `isObservableObject`, `isObservableArray` and `isObservableMap`
|
|
1446
|
+
- introduced `observe`, to observe observable arrays, objects and maps, similarly to Object.observe and Array.observe
|
|
1172
1447
|
|
|
1173
1448
|
# 1.0.3
|
|
1174
1449
|
|
|
1175
|
-
|
|
1450
|
+
- `extendObservable` now supports passing in multiple object properties
|
|
1176
1451
|
|
|
1177
1452
|
# 1.0.2
|
|
1178
1453
|
|
|
1179
|
-
|
|
1454
|
+
- added `mobservable.map()`, which creates a new map similarly to ES6 maps, yet observable. Until properly documentation, see the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
|
1180
1455
|
|
|
1181
1456
|
# 1.0.1
|
|
1182
1457
|
|
|
1183
|
-
|
|
1458
|
+
- Stricter argument checking for several apis.
|
|
1184
1459
|
|
|
1185
1460
|
# 1.0
|
|
1186
1461
|
|
|
1187
1462
|
## Renames
|
|
1188
1463
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1464
|
+
- `isReactive` -> `isObservable`
|
|
1465
|
+
- `makeReactive` -> `observable`
|
|
1466
|
+
- `extendReactive` -> `extendObservable`
|
|
1467
|
+
- `observe` -> `autorun`
|
|
1468
|
+
- `observeUntil` -> `autorunUntil`
|
|
1469
|
+
- `observeAsync` -> `autorunAsync`
|
|
1470
|
+
- `reactiveComponent` -> `observer` (in `mobservable-react` package)
|
|
1196
1471
|
|
|
1197
1472
|
## Breaking changes
|
|
1198
1473
|
|
|
1199
|
-
|
|
1200
|
-
Use `extras.withStrict(boolean, block)` if you want to deviate from the default behavior.
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1474
|
+
- dropped the `strict` and `logLevel` settings of mobservable. View functions are by default run in `strict` mode, `autorun` (formerly: `observe`) functions in `non-strict` mode (strict indicates that it is allowed to change other observable values during the computation of a view funtion).
|
|
1475
|
+
Use `extras.withStrict(boolean, block)` if you want to deviate from the default behavior.
|
|
1476
|
+
- `observable` (formerly `makeReactive`) no longer accepts an options object. The modifiers `asReference`, `asStructure` and `asFlat` can be used instead.
|
|
1477
|
+
- dropped the `default` export of observable
|
|
1478
|
+
- Removed all earlier deprecated functions
|
|
1204
1479
|
|
|
1205
1480
|
## Bugfixes / improvements
|
|
1206
1481
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1482
|
+
- `mobservable` now ships with TypeScript 1.6 compliant module typings, no external typings file is required anymore.
|
|
1483
|
+
- `mobservable-react` supports React Native as well through the import `"mobservable-react/native"`.
|
|
1484
|
+
- Improved debugger support
|
|
1485
|
+
- `for (var key in observablearray)` now lists the correct keys
|
|
1486
|
+
- `@observable` now works correct on classes that are transpiled by either TypeScript or Babel (Not all constructions where supported in Babel earlier)
|
|
1487
|
+
- Simplified error handling, mobservable will no longer catch errors in views, which makes the stack traces easier to debug.
|
|
1488
|
+
- Removed the initial 'welcom to mobservable' logline that was printed during start-up.
|
|
1214
1489
|
|
|
1215
1490
|
# 0.7.1
|
|
1216
1491
|
|
|
1217
|
-
|
|
1492
|
+
- Backported Babel support for the @observable decorator from the 1.0 branch. The decorator should now behave the same when compiled with either Typescript or Babeljs.
|
|
1218
1493
|
|
|
1219
1494
|
# 0.7.0
|
|
1220
1495
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1496
|
+
- Introduced `strict` mode (see issues [#30](), [#31]())
|
|
1497
|
+
- Renamed `sideEffect` to `observe`
|
|
1498
|
+
- Renamed `when` to `observeUntil`
|
|
1499
|
+
- Introduced `observeAsync`.
|
|
1500
|
+
- Fixed issue where changing the `logLevel` was not picked up.
|
|
1501
|
+
- Improved typings.
|
|
1502
|
+
- Introduces `asStructure` (see [#8]()) and `asFlat`.
|
|
1503
|
+
- Assigning a plain object to a reactive structure no longer clones the object, instead, the original object is decorated. (Arrays are still cloned due to Javascript limitations to extend arrays).
|
|
1504
|
+
- Reintroduced `expr(func)` as shorthand for `makeReactive(func)()`, which is useful to create temporarily views inside views
|
|
1505
|
+
- Deprecated the options object that could be passed to `makeReactive`.
|
|
1506
|
+
- Deprecated the options object that could be passed to `makeReactive`:
|
|
1507
|
+
- A `thisArg` can be passed as second param.
|
|
1508
|
+
- A name (for debugging) can be passed as second or third param
|
|
1509
|
+
- The `as` modifier is no longer needed, use `asReference` (instead of `as:'reference'`) or `asFlat` (instead of `recurse:false`).
|
|
1235
1510
|
|
|
1236
1511
|
# 0.6.10
|
|
1237
1512
|
|
|
1238
|
-
|
|
1513
|
+
- Fixed issue where @observable did not properly create a stand-alone view
|
|
1239
1514
|
|
|
1240
1515
|
# 0.6.9
|
|
1241
1516
|
|
|
1242
|
-
|
|
1517
|
+
- Fixed bug where views where sometimes not triggered again if the dependency tree changed to much.
|
|
1243
1518
|
|
|
1244
1519
|
# 0.6.8
|
|
1245
1520
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1521
|
+
- Introduced `when`, which, given a reactive predicate, observes it until it returns true.
|
|
1522
|
+
- Renamed `sideEffect -> observe`
|
|
1248
1523
|
|
|
1249
1524
|
# 0.6.7:
|
|
1250
1525
|
|
|
1251
|
-
|
|
1526
|
+
- Improved logging
|
|
1252
1527
|
|
|
1253
1528
|
# 0.6.6:
|
|
1254
1529
|
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1530
|
+
- Deprecated observable array `.values()` and `.clone()`
|
|
1531
|
+
- Deprecated observeUntilInvalid; use sideEffect instead
|
|
1532
|
+
- Renamed mobservable.toJson to mobservable.toJSON
|
|
1258
1533
|
|
|
1259
1534
|
# 0.6.5:
|
|
1260
1535
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1536
|
+
- It is no longer possible to create impure views; views that alter other reactive values.
|
|
1537
|
+
- Update links to the new documentation.
|
|
1263
1538
|
|
|
1264
1539
|
# 0.6.4:
|
|
1265
1540
|
|
|
1266
|
-
|
|
1541
|
+
- 2nd argument of sideEffect is now the scope, instead of an options object which hadn't any useful properties
|
|
1267
1542
|
|
|
1268
1543
|
# 0.6.3
|
|
1269
1544
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1545
|
+
- Deprecated: reactiveComponent, reactiveComponent from the separate package mobservable-react should be used instead
|
|
1546
|
+
- Store the trackingstack globally, so that multiple instances of mobservable can run together
|
|
1272
1547
|
|
|
1273
1548
|
# 0.6.2
|
|
1274
1549
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1550
|
+
- Deprecated: @observable on functions (use getter functions instead)
|
|
1551
|
+
- Introduced: `getDependencyTree`, `getObserverTree` and `trackTransitions`
|
|
1552
|
+
- Minor performance improvements
|