Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

fix(deps): update dependency mobx to v6 #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Sep 30, 2020

This PR contains the following updates:

Package Type Update Change
mobx (source) dependencies major ^5.9.4 -> ^6.0.0

Release Notes

mobxjs/mobx

v6.0.0

Compare Source

New features

  • makeObservable(target, annotations) is now the recommended way to make objects with a fixed shape observable, such as classes.
  • makeAutoObservable(target) will automatically determine the annotations used by makeObservable. Methods will be marked as 'autoAction', so that they can be used both from a computed value or as standalone method.
  • MobX 6 can be used in both modern environments, and environments that don't support Proxy. So both MobX 4 and 5 users can upgrade to 6. See proxy support for more details.
  • observable.array now supports { proxy: false } as option.
  • reaction's effect function now receives the previous value seen by the reaction as second argument.
  • flow can now be used as annotation as well. You might need flowResult in case you use TypeScript to extract the correct result type. details.

Breaking changes

Changes that might affect you
  • The decorate API has been removed, and needs to be replaced by makeObservable in the constructor of the targeted class. It accepts the same arguments. The mobx-undecorate can transform this automatically.
  • When using extendObservable / observable, fields that contained functions used to be turned into observables. This is no longer the case, they will be converted into autoActions.
  • Strict mode for actions is now enabled by default in observed mode.
  • toJS no longer takes any options. It no longer converts Maps and Sets to plain data structures. Generic, flexible serialization of data structures is out of scope for the MobX project, and writing custom serialization methods is a much more scalable approach to serialization (tip: leverage computeds to define how class instances should be serialized).
  • The methods intercept and observe are no longer exposed on observable arrays, maps and boxed observables. Import them as utility from mobx instead: import { observe, intercept } from "mobx", and pass the collection as first argument: observer(collection, callback). Note that we still recommend to avoid these APIs.
  • observableMap.toPOJO(), observableMap.toJS() have been dropped. Use new Map(observableMap) instead if you want to convert an observable map to a plain Map shallowly.
  • observableMap.toJSON() now returns an entries array rather than a new Map, to better support serialization.
  • observableSet.toJS() has been dropped. Use new Set(observableSet) instead if you want to convert an observable Set to a plain Set shallowly.
  • observableMap.toJSON() now returns an array rather than a new Set, to better support serialization.
  • Sorting or reversing an observableArray in a derivation (without slicing first) will now throw rather than warn. In contrast, it is now allowed to sort or reverse observable arrays in-place, as long as it happens in an action.
  • isArrayLike is no longer exposed as utility. Use Array.isArray(x) || isObservableArray(x) instead.
Obscure things that don't work anymore, but that probably won't affect you
  • It is no longer possible to re-decorate a field (through either @observable or makeObservable) that is already declared in a super class.
  • runInAction no longer supports passing a name as first argument. Name the original function or use action(name, fn)() if you care about the debug name.
  • computed(getterFn, setterFn) no longer accepts a setter function as a second argument. Use the set option instead: computed(getterFn, { set: setterFn }).
  • In observable arrays, for findIndex / find method, the offset argument (the third one) is no longer supported, to be consistent with ES arrays.
  • The option computedConfigurable of configure is no longer supported as it is now the default.
  • observableArray.toJS() has been removed, use observableArray.slice() instead, which does the same.
  • Killed support for the IGNORE_MOBX_MINIFY_WARNING environment flag.
  • _allowStateChangesInComputation(fn) is no longer needed, use runInAction(fn) instead.
  • In computed, the when predicate (first arg), and reaction predicate (first arg) it is now forbidden to directly change state. State changes should be done in their effect functions, or otherwise at least wrapped in runInAction (only the state change, not the observables you want to track!). Note that this is still an anti-pattern.
  • The observableArray.get() and observableArray.set() methods are no longer supported.
  • The IObservableObject interface is no longer exported from MobX.
  • The second argument to the reaction effect function, the disposer object, is now passed in as third argument. The second argument is now the previous value seen by the reaction.
  • onBecomeObserved / onBecomeUnobserved will now only trigger for observables that are actually used by a reaction (see #​2309 for background).

Fixes

  • #​2326: Incorrect this for array callbacks such as in array.forEach
  • #​2379: Fixed issue with array.concat
  • #​2309: Fixed several inconsistencies between keepAlive'd computed values and on(un)BecomeObserved
  • Fixed several inconsistencies when on(un)BecomeObserved was triggered for observables changed in actions without having an observer

Renovate configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant