Posts

Showing posts from March, 2018

JavaScript: Upgrading from MobX 2.6.0 to 2.7.0

As usual, you should check out the CHANGELOG. However, let me point out a few things specifically:

If you have something like: observable({ @computed get someProp() { ... } }); your code will work in 2.6.0, but in 2.7.0 reactions won't occur properly. Your tests will end up timing out. It needs to be: observable({ get someProp() { ... } }); Note, there's no deprecation warning or anything. Also note that this doesn't apply to situations where you're using a class. Those will continue working as before.

As of 2.6.2, toJS no longer recurses once it hits something that isn't observable. Hence, if you have an observable object with a non-observable array with observable objects in it, MobX will only convert the outer object "to JS". You'll need to call toJS again for the things inside the non-observable array. This can cause painful to debug errors.

This change was announced for 2.6.0, but it actually happened in 2.6.2 which means that upgr…