mobx-react 5.4.2 → 5.4.3

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,514 +1,518 @@
1
- # MobX-React Changelog
2
-
3
- ### 5.4.1
4
-
5
- * Fixed issue where `react-is` wasn't properly rolled-up into the package. Fixes [#608](https://github.com/mobxjs/mobx-react/issues/608)
6
-
7
- ### 5.4.0
8
-
9
- * Added support for forward refs, fixes [#602](https://github.com/mobxjs/mobx-react/issues/602)
10
-
11
- ### 5.3.6
12
-
13
- * Fixed some additional issues around life-cycle patching, take 3. See [#536](https://github.com/mobxjs/mobx-react/pull/586) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#579](https://github.com/mobxjs/mobx-react/issues/579)
14
-
15
-
16
- ### 5.3.5
17
-
18
- * Fixed some additional issues around life-cycle patching, see [#583](https://github.com/mobxjs/mobx-react/pull/583) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#581](https://github.com/mobxjs/mobx-react/issues/581)
19
-
20
- ### 5.3.4
21
-
22
- * Fixed unending recursing as a result of lifecylce patching. Fixes [#579](https://github.com/mobxjs/mobx-react/issues/579) through [#582](https://github.com/mobxjs/mobx-react/pull/582) by [@xaviergonz](https://github.com/xaviergonz)
23
-
24
- ### 5.3.3
25
-
26
- * Fixed `Cannot read property 'forEach' of undefined` exception if `disposeOnUnmount` was called conditionally. [#578](https://github.com/mobxjs/mobx-react/pull/578) by [Jef Hellemans](https://github.com/JefHellemans)
27
-
28
- ### 5.3.2
29
-
30
- * Fixed: "process not defined", [#574](https://github.com/mobxjs/mobx-react/pull/574/) through [#576](https://github.com/mobxjs/mobx-react/pull/576/) by [@xaviergonz](https://github.com/xaviergonz)
31
-
32
- ### 5.3.0 / 5.3.1
33
-
34
- _5.3.0 was retracted as files were not generated correctly during publish_
35
-
36
- * Added `disposeOnUnmount` utility / decorator to call disposable properties (reaction, autorun, etc) automatically on `componentWillUnmount`
37
- * Introduced new method to patch lifecycle methods which should be more compatible with for example arrow functions.
38
-
39
-
40
- ### 5.2.8
41
-
42
- * Make sure `mobx-react` doesn't require `Object.assign` polyfill
43
-
44
- ### 5.2.7
45
-
46
- * Fixed issue where React 16.5 printed a warning when using `Provider`, fixes [#545](https://github.com/mobxjs/mobx-react/issues/545)
47
-
48
- ### 5.2.6
49
-
50
- * Fixed bug in defining properties (although the bug had no known observable effect). Fixes [#540](https://github.com/mobxjs/mobx-react/issues/540)
51
-
52
- ### 5.2.4 / 5.2.5
53
-
54
- * Improved compatibility with React-Hot-Loader, see [#522](https://github.com/mobxjs/mobx-react/pull/522) by [theKashey](https://github.com/theKashey). Fixes [#500](https://github.com/mobxjs/mobx-react/issues/500)
55
-
56
- ### 5.2.3
57
-
58
- * Fixed problem with `Symbol` feature detection. By [@Strate](https://github.com/Strate) through [#501](https://github.com/mobxjs/mobx-react/pull/501). Fixes [#498](https://github.com/mobxjs/mobx-react/issues/498) and [#503](https://github.com/mobxjs/mobx-react/issues/503).
59
-
60
- ### 5.2.2
61
-
62
- * Polyfill `Symbol` if it doesn't exist. By [@Strate](https://github.com/Strate) through [#499](https://github.com/mobxjs/mobx-react/pull/499).
63
-
64
- ### 5.2.1
65
-
66
- * Component `props` and `state` properties are now made observable during the instance creation. This restores the behavior from before 5.1.0 where `props` and `state` could safely be observed during mount. Actually it is now possible to do similar things in constructors as well. Fixes [#478](https://github.com/mobxjs/mobx-react/issues/478). Thanks [@Strate](https://github.com/Strate) for the idea and PR! [#496](https://github.com/mobxjs/mobx-react/pull/496).
67
-
68
- ### 5.2.0
69
-
70
- * Added backward compatible support for MobX 5.
71
- * Fixed components sometimes being displayed as `undefined` in mobx-devtools. See [#470](https://github.com/mobxjs/mobx-react/pull/470) by [@MauricioAndrades](https://github.com/MauricioAndrades)
72
- * Removed unnecessary warning `@observer` was used both on a sub and super class. See [#492](https://github.com/mobxjs/mobx-react/pull/476) by [@skiritsis](https://github.com/skiritsis). _N.B. putting `@observer` on a super and subclass is still not an supported pattern, use @observer on subclasses only!_
73
-
74
- ### 5.1.2
75
-
76
- * Fixed regression bug in integration with devtools. Fixed through [#465](https://github.com/mobxjs/mobx-react/pull/465) by @le0nik
77
-
78
- ### 5.1.0
79
-
80
- * Added support for React 16.3, including support for the `getDerivedStateFromProps` life-cycle hook. MobX will no longer use `componentWillMount` hook internally, so that it can be used in `StrictMode` react as well. Fixes [#447](https://github.com/mobx/mobx-react/447)
81
- * Static properties of a function component are now automatically hoisted when the component is wrapped by `observer`. Implements [#427](https://github.com/mobx/mobx-react/427)
82
- * Misspelled export `componentByNodeRegistery` is now properly export as `componentByNodeRegistry` as well, please update consumers, the mispelled version will be dropped in the next major. Fixes [#421](https://github.com/mobx/mobx-react/421)
83
- * Deprecated the support for the `inject` property on `Observer`, it is fundamentally broken and should not be used. Use `inject` on the enclosing component instead and grab the necessary stores from the closure. Fixes [#423](https://github.com/mobx/mobx-react/423)
84
- * Added warning about using `observer` on a React.PureComponent, this will become an exception in the next major. Fixes [#309](https://github.com/mobx/mobx-react/309)
85
- * Mobx-react will now print a warning when combining `observer` with a custom `shouldComponentUpdate` implementation. Fixes [#417](https://github.com/mobx/mobx-react/417)
86
-
87
- ### 5.0.0
88
-
89
- * Added compatibility with MobX 4.x. This version is not compatible with older Mobx versions
90
-
91
- ### 4.4.3
92
-
93
- * The exposed React Native build now uses commonjs, to prevent the need of further transpilation. Fixes [#428](https://github.com/mobxjs/mobx-react/issues/428)
94
-
95
- ### 4.4.2
96
-
97
- * Fixed issue with mobx-react not compiling on react-native due to the presence of a `.babelrc` file. Fixes [#415](https://github.com/mobxjs/mobx-react/issues/415) by [Ryan Rampersad](https://github.com/ryanmr) through [#416](https://github.com/mobxjs/mobx-react/pull/416)
98
-
99
- ### 4.4.1
100
-
101
- * Fixed syntax error in 4.4.0 that escaped
102
-
103
- ### 4.4.0
104
-
105
- * `Observer` now supports render props, `render` and `inject`. See the updated readme. By [ZiYingMai](https://github.com/Sunshine168) through [#403](https://github.com/mobxjs/mobx-react/pull/403)
106
- * Fixed: `NaN` is now considered to be equal to `NaN` when doing reconciliation. Fixes [#363](https://github.com/mobxjs/mobx-react/issues/363), by [Andrew Branch](https://github.com/andrewbranch) through [#402](https://github.com/mobxjs/mobx-react/pull/402)
107
- * Improved typings of `Observer` component, by [Rafał Filipek](https://github.com/RafalFilipek) through [#376](https://github.com/mobxjs/mobx-react/pull/376)
108
- * Fixed incorrect generation of component name, by [Andy Kogut](https://github.com/andykog) through [#368](https://github.com/mobxjs/mobx-react/pull/368)
109
- * Lot of internal repo upgrades: Test suite is now in Jest, Prettier is used etc.
110
-
111
- ### 4.3.5
112
-
113
- Fixed some issues with the typescript typings. See for example #353
114
-
115
- ### 4.3.4
116
-
117
- Improved typescript typings, including support for `strict` mode in TS 2.6. Fixes
118
-
119
- ### 4.3.3
120
-
121
- Added support for React 16. (No changes)
122
-
123
- ### 4.3.2
124
-
125
- Killed accidentally exposed default exports.
126
-
127
- If you are still using `import mobxReact from "mobx-react"`, use `import * as mobxReact from "mobx-react"`, or better `import { whatYouNeed } from "mobx-react"` instead.
128
-
129
- ### 4.3.1
130
-
131
- ### 4.3.0 (unpublished)
132
-
133
- Improved module rollup setup, enabling better tree shaking. See #324 / #328
134
-
135
- ### 4.2.2
136
-
137
- * Fixed check for stateless components, by @leader22, see #280
138
-
139
- ### 4.2.1
140
-
141
- _Note: Due to pull / rebase issue the release commit is incorrect. This is the released [commit](https://github.com/mobxjs/mobx-react/commit/f1b3eefc5239cb451b317204fa8aad94b4dcfc2f)_
142
-
143
- * Reduced module size by 31% (switched to rollup.js). See #244 by @rossipedia
144
- * Skip creation of `.wrappedInstance` reference for stateless components. See #254 by @farwayer
145
- * Introduced global `onError` handler hook to be notified on errors thrown by `@observer` components. See #262 by @andykog
146
- * Improved typescript typings of the exposed `propTypes`, See #263 by @panjiesw
147
-
148
- ### 4.2.0
149
-
150
- * Same as 4.2.1, but contained build issue and is unpublished
151
-
152
- ### 4.1.8
153
-
154
- * Undid change introduced in 4.1.4 where the lifecycle hooks were protected, as this breaks react-hot-loader.... Fixes #231
155
-
156
- ### 4.1.7
157
-
158
- * Added support for React 15.5 (no deprecation warnings) and 16.0 (no proptypes / createClass), by @andykog, see #238. Fixes #233, #237
159
-
160
- ### 4.1.5
161
-
162
- * Improved typescript typings, fixes #223
163
-
164
- ### 4.1.4
165
-
166
- * Made lifecycle hooks used by mobx-react read-only to make sure they are not accidentally overwritten in component instances. Fixes, #195, #202. Note that they can still be defined, just make sure to define them on the prototype (`componentWillMount() {}`) instead of the instance (`componentWillMount = () => {}`). Which is best practice anyway.
167
-
168
- ### 4.1.3
169
-
170
- * Fixed `ReactDOM.findDOMNode` exception when using react-test-runner, #216
171
-
172
- ### 4.1.2
173
-
174
- * Exceptions caught during render are now rethrown with proper stack, fixes #206
175
-
176
- ### 4.1.1
177
-
178
- * Exposed `wrappedInstance` and `wrappedComponent` in typings
179
- * Fixed accidental use of `default` import from `mobx` package.
180
-
181
- ### 4.1.0
182
-
183
- * Added support for MobX3. Note that using MobX3 changes the error semantics. If an `observer` component throws, it will no longer crash the app, but just log the exceptions instead.
184
-
185
- ### 4.0.4
186
-
187
- * Introduced `suppressChangedStoreWarning` to optionally supresss change store warnings, by @dropfen, see #182, #183
188
-
189
- ### 4.0.3
190
-
191
- * Fixed issue where userland componentWilMount was run before observer componentWillMount
192
-
193
- ### 4.0.2
194
-
195
- * Fixed order of `inject` overloads, see #169
196
- * Fixed import of `mobx` when using Webpack without commonjs plugin, see: #168
197
-
198
- ### 4.0.1
199
-
200
- * Improved typings, by @timmolendijk, fixes #164, #166
201
- * Fixed `inject` signature in readme, by @farwayer
202
-
203
- ### 4.0.0
204
-
205
- #### `observer` now uses shallow comparision for all props _(Breaking change)_
206
-
207
- `observer` used to compare all properties shallow in the built-in _shouldComponentUpdate_, except when it received
208
- non-observable data structures.
209
- Because mobx-react cannot know whether a non observable has been deeply modified, it took no chances and just re-renders.
210
-
211
- However, the downside of this when an unchanged, non-observable object is passed in to an observer component again, it would still cause a re-render.
212
- Objects such as styling etc. To fix this mobx-react will now always compare all properties in a pure manner.
213
- In general this should cause no trouble, as typically mutable data in mobx based objects is captured in observable objects, which will still cause components to re-render if needed.
214
-
215
- If you need to pass in a deeply modified object and still want to make sure to cause a re-render, either
216
-
217
- * make sure the object / array is an observable
218
- * do not decorate your component with `observer`, but use `Observer` regions instead (see below)
219
-
220
- See [#160](https://github.com/mobxjs/mobx-react/issues/160) for more details.
221
-
222
- #### `inject(fn)(component)` will now track `fn` as well
223
-
224
- `inject(func)` is now reactive as well, that means that transformations in the selector function will be tracked, see [#111](https://github.com/mobxjs/mobx-react/issues/111)
225
-
226
- ```javascript
227
- const NameDisplayer = ({ name }) => <h1>{name}</h1>
228
-
229
- const UserNameDisplayer = inject(stores => ({
230
- name: stores.userStore.name
231
- }))(NameDisplayer)
232
-
233
- const user = mobx.observable({
234
- name: "Noa"
235
- })
236
-
237
- const App = () => (
238
- <Provider userStore={user}>
239
- <UserNameDisplayer />
240
- </Provider>
241
- )
242
-
243
- ReactDOM.render(<App />, document.body)
244
- ```
245
-
246
- _N.B. note that in this specific case NameDisplayer doesn't have to be an `observer`, as it doesn't receive observables, but just plain data from the transformer function._
247
-
248
- #### `this.props` and `this.state` in React components are now observables as well
249
-
250
- A common cause of confusion were cases like:
251
-
252
- ```javascript
253
- @observer class MyComponent() {
254
- @computed upperCaseName() {
255
- return this.props.user.name.toUpperCase()
256
- }
257
-
258
- render() {
259
- return <h1>{this.upperCaseName}</h1>
260
- }
261
- }
262
- ```
263
-
264
- This component would re-render if `user.name` was modified, but it would still render the previous user's name if a complete new user was received!
265
- The reason for that is that in the above example the only observable tracked by the computed value is `user.name`, but not `this.props.user`.
266
- So a change to the first would be picked up, but a change in `props` itself, assigning a new user, not.
267
-
268
- Although this is technically correct, it was a source of confusion.
269
- For that reason `this.state` and `this.props` are now automatically converted to observables in any `observer` based react component.
270
- For more details, see [#136](https://github.com/mobxjs/mobx-react/pull/136) by @Strate
271
-
272
- #### Better support for Server Side Rendering
273
-
274
- Introduced `useStaticRendering(boolean)` to better support server-side rendering scenarios. See [#140](https://github.com/mobxjs/mobx-react/issues/140)
275
-
276
- #### Introduced `Observer` as alternative syntax to the `observer` decorator.
277
-
278
- _This feature is still experimental and might change in the next minor release, or be deprecated_
279
-
280
- Introduced `Observer`. Can be used as alternative to the `observer` decorator. Marks a component region as reactive.
281
- See the Readme / [#138](https://github.com/mobxjs/mobx-react/issues/138)
282
- Example:
283
-
284
- ```javascript
285
- const UserNameDisplayer = ({ user }) => <Observer>{() => <div>{user.name}</div>}</Observer>
286
- ```
287
-
288
- #### Using `observer` to inject stores is deprecated
289
-
290
- The fact that `observer` could inject stores as well caused quite some confusion.
291
- Because in some cases `observer` would return the original component (when not inject), but it would return a HoC when injecting.
292
- To make this more consistent, you should always use `inject` to inject stores into a component. So use:
293
-
294
- ```
295
- @inject("store1", "store2") @observer
296
- class MyComponent extends React.Component {
297
- ```
298
-
299
- or:
300
-
301
- ```
302
- const MyComponent = inject("store1", "store2")(observer(props => rendering))
303
- ```
304
-
305
- For more info see the related [discussion](https://github.com/mobxjs/mobx-react/commit/666577b41b7af8209839e7b243064a31c9951632#commitcomment-19773706)
306
-
307
- #### Other improvements
308
-
309
- * If `mobx` and `mobx-react` are used in combination, all reactions are run as part of React's batched updates. This minimizes the work of the reconciler, guarantees optimal rendering order of components (if the rendering was not triggered from within a React event). Tnx @gkaemmer for the suggestion.
310
- * It is now possible to directly define `propTypes` and `defaultProps` on components wrapped with `inject` (or `observer(["stores"])`) again, see #120, #142. Removed the warnings for this, and instead improved the docs.
311
- * Clean up data subscriptions if an error is thrown by an `observer` component, see [#134](https://github.com/mobxjs/mobx-react/pull/134) by @andykog
312
- * export `PropTypes` as well in typescript typings, fixes #153
313
- * Add react as a peer dependency
314
- * Added minified browser build: `index.min.js`, fixes #147
315
- * Generate better component names when using `inject`
316
-
317
- ---
318
-
319
- ### 3.5.9
320
-
321
- * Print warning when `inject` and `observer` are used in the wrong order, see #146, by @delaetthomas
322
-
323
- ### 3.5.8
324
-
325
- * Fixed issue where `props` where not passed properly to components in very rare cases. Also fixed #115
326
-
327
- ### 3.5.7
328
-
329
- * Bundles are no longer minified, fixes #127
330
-
331
- ### 3.5.6
332
-
333
- * Export `propTypes` as `PropTypes`, like React (@andykog, ##117)
334
-
335
- ### 3.5.5
336
-
337
- * Removed `experimental` status of `inject` / `Provider`. Official feature now.
338
- * Fixed hot-reloading issue, #101
339
-
340
- ### 3.5.4
341
-
342
- * Introduced `wrappedInstance` by @rossipedia on `inject` decorated HOC's, see https://github.com/mobxjs/mobx-react/pull/90/
343
- * print warnings when assign values to `propTypes`, `defaultProps`, or `contextTypes` of a HOC. (by @jtraub, see https://github.com/mobxjs/mobx-react/pull/88/)
344
- * Static properties are now hoisted to HoC components when, #92
345
- * If `inject` is used incombination with a function, the object return from the function will now be merged into the `nextProps` instead of replacing them, #80
346
- * Always do propType checking untracked, partially fixes #56, #305
347
-
348
- ### 3.5.3
349
-
350
- * Fixed error `Cannot read property 'renderReporter' of undefined` (#96)
351
-
352
- ### 3.5.2
353
-
354
- * Added propTypes.observableArrayOf and propTypes.arrayOrObservableArrayOf (#91)
355
-
356
- ### 3.5.1
357
-
358
- * Fixed regression #85, changes caused by the constructor results in inconsistent rendering (N.B.: that is un-idiomatic React usage and React will warn about this!)
359
-
360
- ### 3.5.0
361
-
362
- * Introduced `inject("store1", "store2")(component)` as alternative syntax to inject stores. Should address #77, #70
363
- * Introduced the `wrappedComponent` property on injected higher order components, addresses #70, #72
364
- * Fixed #76: error when no stores are provided through context
365
- * Added typings for devTools related features (@benjamingr).
366
- * Added MobX specific propTypes (@mattruby)
367
- * Merged #44, fixes #73: don't re-render if component was somehow unmounted
368
-
369
- ### 3.4.0
370
-
371
- * Introduced `Provider` / context support (#53 / MobX #300)
372
- * Fixed issues when using devtools with IE. #66 (By @pvasek)
373
-
374
- ### 3.3.1
375
-
376
- * Added typescript typings form `mobx-react/native` and `mobx-react/custom`
377
- * Fixed #63: error when using stateless function components when using babel and typescript
378
-
379
- ### 3.3.0
380
-
381
- * Upgraded to MobX 2.2.0
382
-
383
- ### 3.2.0
384
-
385
- * Added support for react-native 0.25 and higher. By @danieldunderfelt.
386
-
387
- ### 3.1.0
388
-
389
- * Added support for custom renderers (without DOM), use: `mobx-react/custom` as import fixes #42
390
- * Fixed some issues with rollup #43
391
- * Minor optimization
392
-
393
- ### 3.0.5
394
-
395
- Introduced `componentWillReact`
396
-
397
- ### 3.0.4
398
-
399
- The debug name stateless function components of babel transpiled jsx are now properly picked up if the wrapper is applied after defining the component:
400
-
401
- ```javascript
402
- const MyComponent = () => <span>hi</span>
403
-
404
- export default observer(MyComponent)
405
- ```
406
-
407
- ### 3.0.3
408
-
409
- Removed peer dependencies, React 15 (and 0.13) are supported as well. By @bkniffler
410
-
411
- ### 3.0.2
412
-
413
- Removed the warning introduced in 3.0.1. It triggered always when using shallow rendering (when using shallow rendering `componentDidMount` won't fire. See https://github.com/facebook/react/issues/4919).
414
-
415
- ### 3.0.1
416
-
417
- Added warning when changing state in `getInitialState` / `constructor`.
418
-
419
- ### 3.0.0
420
-
421
- Upgraded to MobX 2.0.0
422
-
423
- ### 2.1.5
424
-
425
- Improved typescript typings overloads of `observer`
426
-
427
- ### 2.1.4
428
-
429
- Added empty 'dependencies' section to package.json, fixes #26
430
-
431
- ### 2.1.3
432
-
433
- Added support for context to stateless components. (by Kosta-Github).
434
-
435
- ### 2.1.1
436
-
437
- Fixed #12: fixed React warning when a component was unmounted after scheduling a re-render but before executing it.
438
-
439
- ### 2.1.0
440
-
441
- Upped dependency of mobx to 1.1.1.
442
-
443
- ### 2.0.1
444
-
445
- It is now possible to define `propTypes` and `getDefaultProps` on a stateless component:
446
-
447
- ```javascript
448
- const myComponent = props => {
449
- // render
450
- }
451
-
452
- myComponent.propTypes = {
453
- name: React.PropTypes.string
454
- }
455
-
456
- myComponent.defaultProps = {
457
- name: "World"
458
- }
459
-
460
- export default observer(myComponent)
461
- ```
462
-
463
- All credits to Jiri Spac for this contribution!
464
-
465
- ### 2.0.0
466
-
467
- Use React 0.14 instead of React 0.13. For React 0.13, use version `mobx-react@1.0.2` or higher.
468
-
469
- ### 1.0.2
470
-
471
- Minor fixes and improvements
472
-
473
- ### 1.0.1
474
-
475
- Fixed issue with typescript typings. An example project with MobX, React, Typescript, TSX can be found here: https://github.com/mobxjs/mobx-react-typescript
476
-
477
- ### 1.0.0
478
-
479
- `reactiveComponent` has been renamed to `observer`
480
-
481
- ### 0.2.3
482
-
483
- Added separte import for react-native: use `var reactiveComponent = require('mobx-react/native').reactiveComponent` for native support; webpack clients will refuse to build otherwise.
484
-
485
- ### 0.2.2
486
-
487
- Added react-native as dependency, so that the package works with either `react` or `react-native`.
488
-
489
- ### 0.2.0
490
-
491
- Upgraded to MobX 0.7.0
492
-
493
- ### 0.1.7
494
-
495
- Fixed issue where Babel generated component classes where not properly picked up.
496
-
497
- ### 0.1.6
498
-
499
- `observer` now accepts a pure render function as argument, besides constructor function. For example:
500
-
501
- ```javascript
502
- var TodoItem = observer(function TodoItem(props) {
503
- var todo = props.todo
504
- return <li>{todo.task}</li>
505
- })
506
- ```
507
-
508
- ### 0.1.5
509
-
510
- observer is now defined in terms of side effects.
511
-
512
- ### 0.1.4
513
-
514
- Added support for React 0.14(RC) by dropping peer dependency
1
+ # MobX-React Changelog
2
+
3
+ ### 5.4.3
4
+
5
+ * Fixed [#612](https://github.com/mobxjs/mobx-react/issues/612), `contextType` was hoisted by `inject`, which shouldn't the case.
6
+
7
+ ### 5.4.1 / 5.4.2
8
+
9
+ * Fixed issue where `react-is` wasn't properly rolled-up into the package. Fixes [#608](https://github.com/mobxjs/mobx-react/issues/608)
10
+
11
+ ### 5.4.0
12
+
13
+ * Added support for forward refs, fixes [#602](https://github.com/mobxjs/mobx-react/issues/602)
14
+
15
+ ### 5.3.6
16
+
17
+ * Fixed some additional issues around life-cycle patching, take 3. See [#536](https://github.com/mobxjs/mobx-react/pull/586) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#579](https://github.com/mobxjs/mobx-react/issues/579)
18
+
19
+
20
+ ### 5.3.5
21
+
22
+ * Fixed some additional issues around life-cycle patching, see [#583](https://github.com/mobxjs/mobx-react/pull/583) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#581](https://github.com/mobxjs/mobx-react/issues/581)
23
+
24
+ ### 5.3.4
25
+
26
+ * Fixed unending recursing as a result of lifecylce patching. Fixes [#579](https://github.com/mobxjs/mobx-react/issues/579) through [#582](https://github.com/mobxjs/mobx-react/pull/582) by [@xaviergonz](https://github.com/xaviergonz)
27
+
28
+ ### 5.3.3
29
+
30
+ * Fixed `Cannot read property 'forEach' of undefined` exception if `disposeOnUnmount` was called conditionally. [#578](https://github.com/mobxjs/mobx-react/pull/578) by [Jef Hellemans](https://github.com/JefHellemans)
31
+
32
+ ### 5.3.2
33
+
34
+ * Fixed: "process not defined", [#574](https://github.com/mobxjs/mobx-react/pull/574/) through [#576](https://github.com/mobxjs/mobx-react/pull/576/) by [@xaviergonz](https://github.com/xaviergonz)
35
+
36
+ ### 5.3.0 / 5.3.1
37
+
38
+ _5.3.0 was retracted as files were not generated correctly during publish_
39
+
40
+ * Added `disposeOnUnmount` utility / decorator to call disposable properties (reaction, autorun, etc) automatically on `componentWillUnmount`
41
+ * Introduced new method to patch lifecycle methods which should be more compatible with for example arrow functions.
42
+
43
+
44
+ ### 5.2.8
45
+
46
+ * Make sure `mobx-react` doesn't require `Object.assign` polyfill
47
+
48
+ ### 5.2.7
49
+
50
+ * Fixed issue where React 16.5 printed a warning when using `Provider`, fixes [#545](https://github.com/mobxjs/mobx-react/issues/545)
51
+
52
+ ### 5.2.6
53
+
54
+ * Fixed bug in defining properties (although the bug had no known observable effect). Fixes [#540](https://github.com/mobxjs/mobx-react/issues/540)
55
+
56
+ ### 5.2.4 / 5.2.5
57
+
58
+ * Improved compatibility with React-Hot-Loader, see [#522](https://github.com/mobxjs/mobx-react/pull/522) by [theKashey](https://github.com/theKashey). Fixes [#500](https://github.com/mobxjs/mobx-react/issues/500)
59
+
60
+ ### 5.2.3
61
+
62
+ * Fixed problem with `Symbol` feature detection. By [@Strate](https://github.com/Strate) through [#501](https://github.com/mobxjs/mobx-react/pull/501). Fixes [#498](https://github.com/mobxjs/mobx-react/issues/498) and [#503](https://github.com/mobxjs/mobx-react/issues/503).
63
+
64
+ ### 5.2.2
65
+
66
+ * Polyfill `Symbol` if it doesn't exist. By [@Strate](https://github.com/Strate) through [#499](https://github.com/mobxjs/mobx-react/pull/499).
67
+
68
+ ### 5.2.1
69
+
70
+ * Component `props` and `state` properties are now made observable during the instance creation. This restores the behavior from before 5.1.0 where `props` and `state` could safely be observed during mount. Actually it is now possible to do similar things in constructors as well. Fixes [#478](https://github.com/mobxjs/mobx-react/issues/478). Thanks [@Strate](https://github.com/Strate) for the idea and PR! [#496](https://github.com/mobxjs/mobx-react/pull/496).
71
+
72
+ ### 5.2.0
73
+
74
+ * Added backward compatible support for MobX 5.
75
+ * Fixed components sometimes being displayed as `undefined` in mobx-devtools. See [#470](https://github.com/mobxjs/mobx-react/pull/470) by [@MauricioAndrades](https://github.com/MauricioAndrades)
76
+ * Removed unnecessary warning `@observer` was used both on a sub and super class. See [#492](https://github.com/mobxjs/mobx-react/pull/476) by [@skiritsis](https://github.com/skiritsis). _N.B. putting `@observer` on a super and subclass is still not an supported pattern, use @observer on subclasses only!_
77
+
78
+ ### 5.1.2
79
+
80
+ * Fixed regression bug in integration with devtools. Fixed through [#465](https://github.com/mobxjs/mobx-react/pull/465) by @le0nik
81
+
82
+ ### 5.1.0
83
+
84
+ * Added support for React 16.3, including support for the `getDerivedStateFromProps` life-cycle hook. MobX will no longer use `componentWillMount` hook internally, so that it can be used in `StrictMode` react as well. Fixes [#447](https://github.com/mobx/mobx-react/447)
85
+ * Static properties of a function component are now automatically hoisted when the component is wrapped by `observer`. Implements [#427](https://github.com/mobx/mobx-react/427)
86
+ * Misspelled export `componentByNodeRegistery` is now properly export as `componentByNodeRegistry` as well, please update consumers, the mispelled version will be dropped in the next major. Fixes [#421](https://github.com/mobx/mobx-react/421)
87
+ * Deprecated the support for the `inject` property on `Observer`, it is fundamentally broken and should not be used. Use `inject` on the enclosing component instead and grab the necessary stores from the closure. Fixes [#423](https://github.com/mobx/mobx-react/423)
88
+ * Added warning about using `observer` on a React.PureComponent, this will become an exception in the next major. Fixes [#309](https://github.com/mobx/mobx-react/309)
89
+ * Mobx-react will now print a warning when combining `observer` with a custom `shouldComponentUpdate` implementation. Fixes [#417](https://github.com/mobx/mobx-react/417)
90
+
91
+ ### 5.0.0
92
+
93
+ * Added compatibility with MobX 4.x. This version is not compatible with older Mobx versions
94
+
95
+ ### 4.4.3
96
+
97
+ * The exposed React Native build now uses commonjs, to prevent the need of further transpilation. Fixes [#428](https://github.com/mobxjs/mobx-react/issues/428)
98
+
99
+ ### 4.4.2
100
+
101
+ * Fixed issue with mobx-react not compiling on react-native due to the presence of a `.babelrc` file. Fixes [#415](https://github.com/mobxjs/mobx-react/issues/415) by [Ryan Rampersad](https://github.com/ryanmr) through [#416](https://github.com/mobxjs/mobx-react/pull/416)
102
+
103
+ ### 4.4.1
104
+
105
+ * Fixed syntax error in 4.4.0 that escaped
106
+
107
+ ### 4.4.0
108
+
109
+ * `Observer` now supports render props, `render` and `inject`. See the updated readme. By [ZiYingMai](https://github.com/Sunshine168) through [#403](https://github.com/mobxjs/mobx-react/pull/403)
110
+ * Fixed: `NaN` is now considered to be equal to `NaN` when doing reconciliation. Fixes [#363](https://github.com/mobxjs/mobx-react/issues/363), by [Andrew Branch](https://github.com/andrewbranch) through [#402](https://github.com/mobxjs/mobx-react/pull/402)
111
+ * Improved typings of `Observer` component, by [Rafał Filipek](https://github.com/RafalFilipek) through [#376](https://github.com/mobxjs/mobx-react/pull/376)
112
+ * Fixed incorrect generation of component name, by [Andy Kogut](https://github.com/andykog) through [#368](https://github.com/mobxjs/mobx-react/pull/368)
113
+ * Lot of internal repo upgrades: Test suite is now in Jest, Prettier is used etc.
114
+
115
+ ### 4.3.5
116
+
117
+ Fixed some issues with the typescript typings. See for example #353
118
+
119
+ ### 4.3.4
120
+
121
+ Improved typescript typings, including support for `strict` mode in TS 2.6. Fixes
122
+
123
+ ### 4.3.3
124
+
125
+ Added support for React 16. (No changes)
126
+
127
+ ### 4.3.2
128
+
129
+ Killed accidentally exposed default exports.
130
+
131
+ If you are still using `import mobxReact from "mobx-react"`, use `import * as mobxReact from "mobx-react"`, or better `import { whatYouNeed } from "mobx-react"` instead.
132
+
133
+ ### 4.3.1
134
+
135
+ ### 4.3.0 (unpublished)
136
+
137
+ Improved module rollup setup, enabling better tree shaking. See #324 / #328
138
+
139
+ ### 4.2.2
140
+
141
+ * Fixed check for stateless components, by @leader22, see #280
142
+
143
+ ### 4.2.1
144
+
145
+ _Note: Due to pull / rebase issue the release commit is incorrect. This is the released [commit](https://github.com/mobxjs/mobx-react/commit/f1b3eefc5239cb451b317204fa8aad94b4dcfc2f)_
146
+
147
+ * Reduced module size by 31% (switched to rollup.js). See #244 by @rossipedia
148
+ * Skip creation of `.wrappedInstance` reference for stateless components. See #254 by @farwayer
149
+ * Introduced global `onError` handler hook to be notified on errors thrown by `@observer` components. See #262 by @andykog
150
+ * Improved typescript typings of the exposed `propTypes`, See #263 by @panjiesw
151
+
152
+ ### 4.2.0
153
+
154
+ * Same as 4.2.1, but contained build issue and is unpublished
155
+
156
+ ### 4.1.8
157
+
158
+ * Undid change introduced in 4.1.4 where the lifecycle hooks were protected, as this breaks react-hot-loader.... Fixes #231
159
+
160
+ ### 4.1.7
161
+
162
+ * Added support for React 15.5 (no deprecation warnings) and 16.0 (no proptypes / createClass), by @andykog, see #238. Fixes #233, #237
163
+
164
+ ### 4.1.5
165
+
166
+ * Improved typescript typings, fixes #223
167
+
168
+ ### 4.1.4
169
+
170
+ * Made lifecycle hooks used by mobx-react read-only to make sure they are not accidentally overwritten in component instances. Fixes, #195, #202. Note that they can still be defined, just make sure to define them on the prototype (`componentWillMount() {}`) instead of the instance (`componentWillMount = () => {}`). Which is best practice anyway.
171
+
172
+ ### 4.1.3
173
+
174
+ * Fixed `ReactDOM.findDOMNode` exception when using react-test-runner, #216
175
+
176
+ ### 4.1.2
177
+
178
+ * Exceptions caught during render are now rethrown with proper stack, fixes #206
179
+
180
+ ### 4.1.1
181
+
182
+ * Exposed `wrappedInstance` and `wrappedComponent` in typings
183
+ * Fixed accidental use of `default` import from `mobx` package.
184
+
185
+ ### 4.1.0
186
+
187
+ * Added support for MobX3. Note that using MobX3 changes the error semantics. If an `observer` component throws, it will no longer crash the app, but just log the exceptions instead.
188
+
189
+ ### 4.0.4
190
+
191
+ * Introduced `suppressChangedStoreWarning` to optionally supresss change store warnings, by @dropfen, see #182, #183
192
+
193
+ ### 4.0.3
194
+
195
+ * Fixed issue where userland componentWilMount was run before observer componentWillMount
196
+
197
+ ### 4.0.2
198
+
199
+ * Fixed order of `inject` overloads, see #169
200
+ * Fixed import of `mobx` when using Webpack without commonjs plugin, see: #168
201
+
202
+ ### 4.0.1
203
+
204
+ * Improved typings, by @timmolendijk, fixes #164, #166
205
+ * Fixed `inject` signature in readme, by @farwayer
206
+
207
+ ### 4.0.0
208
+
209
+ #### `observer` now uses shallow comparision for all props _(Breaking change)_
210
+
211
+ `observer` used to compare all properties shallow in the built-in _shouldComponentUpdate_, except when it received
212
+ non-observable data structures.
213
+ Because mobx-react cannot know whether a non observable has been deeply modified, it took no chances and just re-renders.
214
+
215
+ However, the downside of this when an unchanged, non-observable object is passed in to an observer component again, it would still cause a re-render.
216
+ Objects such as styling etc. To fix this mobx-react will now always compare all properties in a pure manner.
217
+ In general this should cause no trouble, as typically mutable data in mobx based objects is captured in observable objects, which will still cause components to re-render if needed.
218
+
219
+ If you need to pass in a deeply modified object and still want to make sure to cause a re-render, either
220
+
221
+ * make sure the object / array is an observable
222
+ * do not decorate your component with `observer`, but use `Observer` regions instead (see below)
223
+
224
+ See [#160](https://github.com/mobxjs/mobx-react/issues/160) for more details.
225
+
226
+ #### `inject(fn)(component)` will now track `fn` as well
227
+
228
+ `inject(func)` is now reactive as well, that means that transformations in the selector function will be tracked, see [#111](https://github.com/mobxjs/mobx-react/issues/111)
229
+
230
+ ```javascript
231
+ const NameDisplayer = ({ name }) => <h1>{name}</h1>
232
+
233
+ const UserNameDisplayer = inject(stores => ({
234
+ name: stores.userStore.name
235
+ }))(NameDisplayer)
236
+
237
+ const user = mobx.observable({
238
+ name: "Noa"
239
+ })
240
+
241
+ const App = () => (
242
+ <Provider userStore={user}>
243
+ <UserNameDisplayer />
244
+ </Provider>
245
+ )
246
+
247
+ ReactDOM.render(<App />, document.body)
248
+ ```
249
+
250
+ _N.B. note that in this specific case NameDisplayer doesn't have to be an `observer`, as it doesn't receive observables, but just plain data from the transformer function._
251
+
252
+ #### `this.props` and `this.state` in React components are now observables as well
253
+
254
+ A common cause of confusion were cases like:
255
+
256
+ ```javascript
257
+ @observer class MyComponent() {
258
+ @computed upperCaseName() {
259
+ return this.props.user.name.toUpperCase()
260
+ }
261
+
262
+ render() {
263
+ return <h1>{this.upperCaseName}</h1>
264
+ }
265
+ }
266
+ ```
267
+
268
+ This component would re-render if `user.name` was modified, but it would still render the previous user's name if a complete new user was received!
269
+ The reason for that is that in the above example the only observable tracked by the computed value is `user.name`, but not `this.props.user`.
270
+ So a change to the first would be picked up, but a change in `props` itself, assigning a new user, not.
271
+
272
+ Although this is technically correct, it was a source of confusion.
273
+ For that reason `this.state` and `this.props` are now automatically converted to observables in any `observer` based react component.
274
+ For more details, see [#136](https://github.com/mobxjs/mobx-react/pull/136) by @Strate
275
+
276
+ #### Better support for Server Side Rendering
277
+
278
+ Introduced `useStaticRendering(boolean)` to better support server-side rendering scenarios. See [#140](https://github.com/mobxjs/mobx-react/issues/140)
279
+
280
+ #### Introduced `Observer` as alternative syntax to the `observer` decorator.
281
+
282
+ _This feature is still experimental and might change in the next minor release, or be deprecated_
283
+
284
+ Introduced `Observer`. Can be used as alternative to the `observer` decorator. Marks a component region as reactive.
285
+ See the Readme / [#138](https://github.com/mobxjs/mobx-react/issues/138)
286
+ Example:
287
+
288
+ ```javascript
289
+ const UserNameDisplayer = ({ user }) => <Observer>{() => <div>{user.name}</div>}</Observer>
290
+ ```
291
+
292
+ #### Using `observer` to inject stores is deprecated
293
+
294
+ The fact that `observer` could inject stores as well caused quite some confusion.
295
+ Because in some cases `observer` would return the original component (when not inject), but it would return a HoC when injecting.
296
+ To make this more consistent, you should always use `inject` to inject stores into a component. So use:
297
+
298
+ ```
299
+ @inject("store1", "store2") @observer
300
+ class MyComponent extends React.Component {
301
+ ```
302
+
303
+ or:
304
+
305
+ ```
306
+ const MyComponent = inject("store1", "store2")(observer(props => rendering))
307
+ ```
308
+
309
+ For more info see the related [discussion](https://github.com/mobxjs/mobx-react/commit/666577b41b7af8209839e7b243064a31c9951632#commitcomment-19773706)
310
+
311
+ #### Other improvements
312
+
313
+ * If `mobx` and `mobx-react` are used in combination, all reactions are run as part of React's batched updates. This minimizes the work of the reconciler, guarantees optimal rendering order of components (if the rendering was not triggered from within a React event). Tnx @gkaemmer for the suggestion.
314
+ * It is now possible to directly define `propTypes` and `defaultProps` on components wrapped with `inject` (or `observer(["stores"])`) again, see #120, #142. Removed the warnings for this, and instead improved the docs.
315
+ * Clean up data subscriptions if an error is thrown by an `observer` component, see [#134](https://github.com/mobxjs/mobx-react/pull/134) by @andykog
316
+ * export `PropTypes` as well in typescript typings, fixes #153
317
+ * Add react as a peer dependency
318
+ * Added minified browser build: `index.min.js`, fixes #147
319
+ * Generate better component names when using `inject`
320
+
321
+ ---
322
+
323
+ ### 3.5.9
324
+
325
+ * Print warning when `inject` and `observer` are used in the wrong order, see #146, by @delaetthomas
326
+
327
+ ### 3.5.8
328
+
329
+ * Fixed issue where `props` where not passed properly to components in very rare cases. Also fixed #115
330
+
331
+ ### 3.5.7
332
+
333
+ * Bundles are no longer minified, fixes #127
334
+
335
+ ### 3.5.6
336
+
337
+ * Export `propTypes` as `PropTypes`, like React (@andykog, ##117)
338
+
339
+ ### 3.5.5
340
+
341
+ * Removed `experimental` status of `inject` / `Provider`. Official feature now.
342
+ * Fixed hot-reloading issue, #101
343
+
344
+ ### 3.5.4
345
+
346
+ * Introduced `wrappedInstance` by @rossipedia on `inject` decorated HOC's, see https://github.com/mobxjs/mobx-react/pull/90/
347
+ * print warnings when assign values to `propTypes`, `defaultProps`, or `contextTypes` of a HOC. (by @jtraub, see https://github.com/mobxjs/mobx-react/pull/88/)
348
+ * Static properties are now hoisted to HoC components when, #92
349
+ * If `inject` is used incombination with a function, the object return from the function will now be merged into the `nextProps` instead of replacing them, #80
350
+ * Always do propType checking untracked, partially fixes #56, #305
351
+
352
+ ### 3.5.3
353
+
354
+ * Fixed error `Cannot read property 'renderReporter' of undefined` (#96)
355
+
356
+ ### 3.5.2
357
+
358
+ * Added propTypes.observableArrayOf and propTypes.arrayOrObservableArrayOf (#91)
359
+
360
+ ### 3.5.1
361
+
362
+ * Fixed regression #85, changes caused by the constructor results in inconsistent rendering (N.B.: that is un-idiomatic React usage and React will warn about this!)
363
+
364
+ ### 3.5.0
365
+
366
+ * Introduced `inject("store1", "store2")(component)` as alternative syntax to inject stores. Should address #77, #70
367
+ * Introduced the `wrappedComponent` property on injected higher order components, addresses #70, #72
368
+ * Fixed #76: error when no stores are provided through context
369
+ * Added typings for devTools related features (@benjamingr).
370
+ * Added MobX specific propTypes (@mattruby)
371
+ * Merged #44, fixes #73: don't re-render if component was somehow unmounted
372
+
373
+ ### 3.4.0
374
+
375
+ * Introduced `Provider` / context support (#53 / MobX #300)
376
+ * Fixed issues when using devtools with IE. #66 (By @pvasek)
377
+
378
+ ### 3.3.1
379
+
380
+ * Added typescript typings form `mobx-react/native` and `mobx-react/custom`
381
+ * Fixed #63: error when using stateless function components when using babel and typescript
382
+
383
+ ### 3.3.0
384
+
385
+ * Upgraded to MobX 2.2.0
386
+
387
+ ### 3.2.0
388
+
389
+ * Added support for react-native 0.25 and higher. By @danieldunderfelt.
390
+
391
+ ### 3.1.0
392
+
393
+ * Added support for custom renderers (without DOM), use: `mobx-react/custom` as import fixes #42
394
+ * Fixed some issues with rollup #43
395
+ * Minor optimization
396
+
397
+ ### 3.0.5
398
+
399
+ Introduced `componentWillReact`
400
+
401
+ ### 3.0.4
402
+
403
+ The debug name stateless function components of babel transpiled jsx are now properly picked up if the wrapper is applied after defining the component:
404
+
405
+ ```javascript
406
+ const MyComponent = () => <span>hi</span>
407
+
408
+ export default observer(MyComponent)
409
+ ```
410
+
411
+ ### 3.0.3
412
+
413
+ Removed peer dependencies, React 15 (and 0.13) are supported as well. By @bkniffler
414
+
415
+ ### 3.0.2
416
+
417
+ Removed the warning introduced in 3.0.1. It triggered always when using shallow rendering (when using shallow rendering `componentDidMount` won't fire. See https://github.com/facebook/react/issues/4919).
418
+
419
+ ### 3.0.1
420
+
421
+ Added warning when changing state in `getInitialState` / `constructor`.
422
+
423
+ ### 3.0.0
424
+
425
+ Upgraded to MobX 2.0.0
426
+
427
+ ### 2.1.5
428
+
429
+ Improved typescript typings overloads of `observer`
430
+
431
+ ### 2.1.4
432
+
433
+ Added empty 'dependencies' section to package.json, fixes #26
434
+
435
+ ### 2.1.3
436
+
437
+ Added support for context to stateless components. (by Kosta-Github).
438
+
439
+ ### 2.1.1
440
+
441
+ Fixed #12: fixed React warning when a component was unmounted after scheduling a re-render but before executing it.
442
+
443
+ ### 2.1.0
444
+
445
+ Upped dependency of mobx to 1.1.1.
446
+
447
+ ### 2.0.1
448
+
449
+ It is now possible to define `propTypes` and `getDefaultProps` on a stateless component:
450
+
451
+ ```javascript
452
+ const myComponent = props => {
453
+ // render
454
+ }
455
+
456
+ myComponent.propTypes = {
457
+ name: React.PropTypes.string
458
+ }
459
+
460
+ myComponent.defaultProps = {
461
+ name: "World"
462
+ }
463
+
464
+ export default observer(myComponent)
465
+ ```
466
+
467
+ All credits to Jiri Spac for this contribution!
468
+
469
+ ### 2.0.0
470
+
471
+ Use React 0.14 instead of React 0.13. For React 0.13, use version `mobx-react@1.0.2` or higher.
472
+
473
+ ### 1.0.2
474
+
475
+ Minor fixes and improvements
476
+
477
+ ### 1.0.1
478
+
479
+ Fixed issue with typescript typings. An example project with MobX, React, Typescript, TSX can be found here: https://github.com/mobxjs/mobx-react-typescript
480
+
481
+ ### 1.0.0
482
+
483
+ `reactiveComponent` has been renamed to `observer`
484
+
485
+ ### 0.2.3
486
+
487
+ Added separte import for react-native: use `var reactiveComponent = require('mobx-react/native').reactiveComponent` for native support; webpack clients will refuse to build otherwise.
488
+
489
+ ### 0.2.2
490
+
491
+ Added react-native as dependency, so that the package works with either `react` or `react-native`.
492
+
493
+ ### 0.2.0
494
+
495
+ Upgraded to MobX 0.7.0
496
+
497
+ ### 0.1.7
498
+
499
+ Fixed issue where Babel generated component classes where not properly picked up.
500
+
501
+ ### 0.1.6
502
+
503
+ `observer` now accepts a pure render function as argument, besides constructor function. For example:
504
+
505
+ ```javascript
506
+ var TodoItem = observer(function TodoItem(props) {
507
+ var todo = props.todo
508
+ return <li>{todo.task}</li>
509
+ })
510
+ ```
511
+
512
+ ### 0.1.5
513
+
514
+ observer is now defined in terms of side effects.
515
+
516
+ ### 0.1.4
517
+
518
+ Added support for React 0.14(RC) by dropping peer dependency