github mobxjs/mobx-state-tree v5.0.4
Version 5.0.4

latest releases: v7.0.0-pre.2, v7.0.0-pre.1, v6.0.1...
3 years ago

This patch-level release fixes three issues with node reconciliation. Thanks to @adamkovalsky for the PR!

  • Adds a getReconcilationType method to BaseNode, which returns the type which should be used for reconcilating the node. This is normally the node's type, but in the case of snapshotProcessor it is overridden to be the snapshotProcessor type. This is necessary so that the union type reconcile can correctly reconcile the "current" node first if it's possible. This fixes #1791.
  • Fixes the snapshotProcessor type's isValidSnapshot and is methods to return a validation error and not to throw if the specified preprocessor fails, which can happen when checking if an arbitrary snapshot is valid input (e.g. when determining a union type). We can't expect preprocessors to accept any arbitrary input, so we must assume they can throw when provided with invalid snapshots. This also fixes #1777.
  • Fixes the array's areSame utility to first check that the provided value is a valid snapshot before calling isMatchingSnapshotId, to avoid the preprocessor throwing an error if the provided snapshot is invalid.

If there are any problems with this release, please file an issue or leave comments in the attached Discussion! Thanks to everyone who contributed!

Don't miss a new mobx-state-tree release

NewReleases is sending notifications on new releases.