-
Notifications
You must be signed in to change notification settings - Fork 6
A bug in clean-embedded-children #8
Comments
Can you please PR a failing test case? |
Let me try to explain it in another way instead. It is quite simple really. Attributes are stored in three places in Ember Data _data (saved data), _attributes (dirty attribute values), _inFlightAttributes (values that are being saved and about to be applied to _data). In your code you just clear out _attributes like this
That way dirty values are lost. What is missing is
before that. If you assign _inFlightAttributes, didCommit will merge them back to _data. |
Thank you for your explanation. But could you provide a sequence of steps of working with a StainedByChildren-powered model that result in the issue? I need a failing test case. |
@Mifrill Hey comrade, this addon is entirely unmaintained and is likely to be incompatible with modern versions of Ember Data since it was relying on private API. |
@lolmaus okay, thanks for the quick response, will deprecate this addon for our app then, thank you! |
Found a bug in the clean-embedded-children.
After doing this
the child will become non-dirty, BUT all changed attributes will have old(original) value. So if, for example, you change a field again to it's previous value, it would not become dirty.
After some debugging, the right way to do it I think is
That way after 'didCommit' all values from '_inFlightAttributes ' will be merged to '_data' automatically, so that values do update.
Also I think doing 'willCommit' and 'didCommit' for rollback is redundant.
The text was updated successfully, but these errors were encountered: