github mobxjs/mobx-state-tree v7.0.0-pre.2

pre-releaseone month ago

Breaking Changes

  • Validate state tree instances instead of snapshots in the SnapshotProcessor.is override by @airhorns in #2182
  • Fix typings for snapshot processor by @thegedge in #2198 (we also consider this a fix)

Features

  • Type create/validate to accept an instance type by @thegedge in #2199

Fixes

  • Fix tsconfig and typechecking by @thegedge in #2200
  • Fix typings for snapshot processor by @thegedge in #2198 (for some users, this may break types if you relied on prior type assumptions)

Migration Path

For most users, migrating from v6 -> v7 will be straightforward and require no work. However, we have made a breaking change in the assumption for types.snapshoProcessor and its is method.

In v6, we validated processed snapshots in this method. But now we will only validate instances. If you upgrade to v7 and all of your TypeScript types and runtime tests are passing, no additional work necessary on your end.

If this change has broken you, it may in fact be surfacing subtle bugs or gaps in your type modeling where your codebase is considering two different types to be "the same" because they have matching SnapshotOut shapes. If you need to preserve that behavior in your codebase, you might consider writing custom logic to check for this type of equality. MST is specifically taking a stance to check against Instances and valid SnapshotIn types.

The snapshot processor typings have also changed, which may break during upgrade, but for the most part we have relaxed them to be more correct. If you relied on old workarounds, you may be able to remove custom type assertions.

Full Changelog: v6.0.1...v7.0.0-pre.2

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

NewReleases is sending notifications on new releases.