Skip to main content


Showing posts from August, 2018

JavaScript: Upgrading from MobX 2.7.0 to 3.0.2

As usual, you should check out the CHANGELOG . However, let me point out a few things specifically: Don't use the @action decorator on a singleton object that you pass to observable() . If you have code that looks like observable({ @action f: () => {}) , you should change it to observable({ f: action(() => {}) . Apparently, using decorators on singleton objects is a little sketchy. I assume the same thing applies to extendObservable. If you're using classes, it's a non-issue. If you have a resolution field in package.json that lists mobx, make sure you keep it in sync with the version of mobx you're trying to install. Otherwise, you'll end up with multiple versions of mobx, each with their own state, and that led to ultra-weird behavior for me. When passing an object to observable() , remember that it now makes a copy of that object. That was already the case for arrays and maps, but now it's also the case for normal objects. Hence, when you pass an