mobx 5.14.1 → 5.15.2

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