You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've observed that DS.Model.changedAttributes() behaves differently on new records than on saved ones (the behaviour on the saved models looks correct to me, the one in the new records seems as bug)
If you create a new record and change some of its attributes, model.changedAttributes() will return an object with the properties that have changed and the current and previous value, and model.isDirty is true. So far so good.
But when you save it, while the request is pending and the record is still being saved, on the new record the changed attributes is cleared (an empty object), while on the already saved record it the changed attributes don't change until the save operation completes.
The behaviour of the saved records seems the right one. The dirty attributes should remain dirty until we get confirmation from the API).
In both cases the record's isDirty property is true, is just the changedAttributes() function the one that returns the wrong value.
I've observed that
DS.Model.changedAttributes()
behaves differently on new records than on saved ones (the behaviour on the saved models looks correct to me, the one in the new records seems as bug)If you create a new record and change some of its attributes,
model.changedAttributes()
will return an object with the properties that have changed and the current and previous value, andmodel.isDirty
is true. So far so good.But when you save it, while the request is pending and the record is still being saved, on the new record the changed attributes is cleared (an empty object), while on the already saved record it the changed attributes don't change until the save operation completes.
The behaviour of the saved records seems the right one. The dirty attributes should remain dirty until we get confirmation from the API).
In both cases the record's
isDirty
property is true, is just thechangedAttributes()
function the one that returns the wrong value.Reproducible live example: http://development.dummy-app.divshot.io/ember-data-dirty-bug
Code: https://github.com/cibernox/dummy-app-for-benchmark
Also I'm curious about why
changedAttributes
is a function and not a computedProperty.The text was updated successfully, but these errors were encountered: