-
Notifications
You must be signed in to change notification settings - Fork 4
Migrating from v3 to v4
The version 4 has five breaking changes:
The record baseUrl
property was removed in favour of the endpoint
property. It behaves in the same way (if not set, it will default to the record type). As an additional feature, endpoint can be a function that will be called before each network request.
Failing network requests will always throw with a Response
object
In v3, some of the network request would throw with an Error object, and other would resolve with a Response
object with the error
property.
In v4, all network requests that failed (either because of network errors or JSON API errors) will throw with the Response
object with the error
property. Depending on the error, the property will contain the Error
object or an JSON API error
object / array of objects.
JSON API spec doesn't prevent a type
or id
property inside of attributes
or relationships
and therefore a collision could happen. In v4, the record type and id will be available as getRecordType()
and getRecordId()
methods.
When creating a record, the second argument can be either the record type or an object with type
and id
properties.
MobX is still a peer dependency, but version 3 is the minimal requirement. mobx-collection-store
is now a regular dependency and the minimal required version is 2.
The record snapshots are in a different format. If you used them only to serialize/deserialize data everything will continue to work as expected.