Please read the Feature Flag Guide for a detailed explanation.
To add a new feature flag or change an existing one, you can add an
entry in config/features.json
.
Ember Data features flags must begin with ds-
, such as
ds-new-coalescing
.
-
ds-improved-ajax
#3099This feature allows to customize how a request is formed by overwriting
methodForRequest
,urlForRequest
,headersForRequest
andbodyForRequest
in theDS.RESTAdapter
. -
ds-pushpayload-return
#4110Enables
pushPayload
to return the model(s) that are created or updated via the internalstore.push
. -
ds-extended-errors
#3586 #4287Enables
extend
method on errors. It means you can extend fromDS.AdapterError
.const MyCustomError = DS.AdapterError.extend({ message: "My custom error." });
It will also add a few new errors to rest adapter based on http status.
- [401]
DS.UnauthorizedError
- [403]
DS.ForbiddenError
- [404]
DS.NotFoundError
- [409]
DS.ConflictError
- [500]
DS.ServerError
- [401]
-
ds-payload-type-hooks
#4318Adds two new hooks
modelNameFromPayloadType
andpayloadTypeFromModelName
hooks to the serializers. They are used to map a custom type in the payload to the Ember-Data model name and vice versa.It also deprecates
modelNameFromPayloadKey
andpayloadKeyFromModelName
for the JSONSerializer and JSONAPISerializer: those payloads don't have keys which represent a model name. Only the keys in the payload for a RESTSerializer represent model names, so thepayloadKeyFromModelName
andmodelNameFromPayloadKey
are available in that serializer.// rest response { "blog/post": { "id": 1, "user": 1, "userType": "api::v1::administrator" } } // RESTSerializer invokes the following hooks restSerializer.modelNameFromPayloadKey("blog/post"); restSerializer.modelNameFromPayloadType("api::v1::administrator");
// json-api response { "data": { "id": 1, "type": "api::v1::administrator", "relationships": { "supervisor": { "data": { "id": 1, "type": "api::v1::super-user" } } } } } // JSONAPISerializer invokes the following hooks jsonApiSerializer.modelNameFromPayloadType("api::v1::administrator"); jsonApiSerializer.modelNameFromPayloadType("api::v1::super-user");
-
ds-overhaul-references
#4398This tackles some inconsistencies within
push()
on references. It should only be used to push a JSON-API payload. The following use cases are addressed and deprecated:-
BelongsToReference#push()
accepts aDS.Model
-
HasManyReference#push()
accepts a plain array -
HasManyReference#push()
accepts a pseudo-JSON-API format:{ data: [ { data: { type: 'model', id: 1 } } ] }
-
-
ds-check-should-serialize-relationships
#4279Adds public method for
shouldSerializeHasMany
, used to determine if ahasMany
relationship can be serialized. -
ds-rollback-attribute
#4246Adds a
rollbackAttribute
method to models. Similar torollbackAttributes
, but for only a single attribute.// { firstName: 'Tom', lastName: 'Dale' } let tom = store.peekRecord('person', 1); tom.setProperties({ firstName: 'Yehuda', lastName: 'Katz' }); tom.rollbackAttribute('firstName') // { firstName: 'Tom', lastName: 'Katz' } tom.get('hasDirtyAttributes') // true tom.rollbackAttribute('lastName') // { firstName: 'Tom', lastName: 'Dale' } tom.get('hasDirtyAttributes') // false
-
ds-serialize-id
#4620Adds a
serializeId
method to JSONSerializer.// app/serializers/application.js import DS from 'ember-data'; export default DS.JSONSerializer.extend({ serializeId(snapshot, json, primaryKey) { var id = snapshot.id; json[primaryKey] = parseInt(id, 10); } });
-
ds-deprecate-store-serialize
#4654Adds a deprecation warning when using Store#serialize(record) method. You can use record.serialize() instead.