v5.0.4
版本发布时间: 2021-10-26 00:54:37
mobxjs/mobx-state-tree最新发布版本:v7.0.0-pre.2(2024-08-02 01:56:53)
This patch-level release fixes three issues with node reconciliation. Thanks to @adamkovalsky for the PR!
- Adds a
getReconcilationType
method toBaseNode
, which returns the type which should be used for reconcilating the node. This is normally the node'stype
, but in the case ofsnapshotProcessor
it is overridden to be thesnapshotProcessor
type. This is necessary so that the union typereconcile
can correctly reconcile the "current" node first if it's possible. This fixes #1791. - Fixes the
snapshotProcessor
type'sisValidSnapshot
andis
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 callingisMatchingSnapshotId
, 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!