All Versions
173
Latest Version
Avg Release Cycle
27 days
Latest Release
1253 days ago

Changelog History
Page 5

  • v5.0.1 Changes

    • πŸ›  Fixed regression bug: ObservableMap.size was no longer observable. Fixes #1583
    • ⬇️ Downgraded lib export from ES6 to ES5. To many build tools still trip over ES6. Fixes #1584. A modern build is available through import ... from "mobx/lib/mobx.es6" (or setup an alias in your build system)
    • πŸ‘ Added support for mobx-react-devtools
  • v5.0.0 Changes

    πŸš€ Release blogpost

    πŸ‘ Proxy support!

    MobX 5 is the first MobX version fully leveraging Proxies. This has two big advantages

    1. MobX can now detect the addition of properties on plain observable objects, so it is now possible to use plain observable objects as dynamic collections.
    2. Observable arrays are now recognized as arrays by all third party libraries, which will avoid the need to slice them.

    The system requirements to run MobX has been upped

    • πŸ‘€ MobX 5 can only be used on environments that support Proxies. See the browser support for details.
    • ⬆️ 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.
    • 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 are needed.
    • 🐎 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.

    πŸ’₯ Breaking changes

    • πŸ‘ The required runtime needs to support the non-polyfillable Proxy API.
    • The minimum runtime target is now ES2015, not ES5
    • πŸ— spy has become a no-op in production builds
    • ⬆️ All earlier deprecated APIs are dropped. Make sure to not have any deprecation warnings before upgrading.
    • 🚚 array.move and array.peek are removed from the API
    • Dropped the third argument to array.find and array.findIndex since they were not standardized in ES.
    • .$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.
    • 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!)

    πŸ†• New features

    • 🚚 It is possible to pass the proxy: false argument to observable.object to disable proxying (theoretically slightly faster, but removes no dynamic key addition)

    Known Issues

    • πŸ’… 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}} />.
    • ⬆️ If you are using mobx with mobx-react, and you are upgrading mobx-react to the MobX 5 compatible version ([email protected]) 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. Fixed in mobx-react 5.2.1. But note that you should still migrate away from componentWillMount😎.
    • β†ͺ 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. The simple work around for now is to slice (or toJS if the problem is recursive) the array first.
    • β†ͺ 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. 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.

    Note June 7th, 2018: Both issues are already in Jest master and should be released soon.

    Migration guide

    • πŸ—„ 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.
    • You could perform the following clean ups:
      • 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)
      • You could replace observable maps with observable objects if you are only using string-based keys.
    • 🐎 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).
    • 🚚 you may remove usages of isArrayLike() since Array.isArray() will now return true for observable arrays

    API's that have been dropped

    • πŸ”§ The arrayBuffer setting is no longer supported by configure (it has become irrelevant)
    • 🚚 observable.shallowBox, observable.shallowArray, observable.shallowMap, observable.shallowObject, extendShallowObservable api's have been removed. Instead, pass { deep: false } to their non-shallow counter parts.
    • 🚚 observableArray.peek, observableArray.move
  • v4.15.7

    September 19, 2020
  • v4.15.6

    August 17, 2020
  • v4.15.5

    August 05, 2020
  • v4.15.4

    January 28, 2020
  • v4.15.3

    January 24, 2020
  • v4.15.2

    January 13, 2020
  • v4.15.1

    December 14, 2019
  • v4.15.0

    November 07, 2019