-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
model.rollbackAttributes with errors doesn't clear hasDirtyAttributes #3499
Comments
Closing as a dupe of #3498, please feel free to reopen if I'm mistaken. |
I'm not smart enough with ember data to know. If #3498 is resolved & model.hasDirtyAttributes is still true then I'll reopen. I guess I can't really know until that one is fixed. |
I had some quality time with ember data internals today. Also new to the low level ember data stuff ;) I'm experiencing this issue here while not having problems with attribute errors like detailed in #3498. In the debugger i see they are cleared. But hasDirtyAttributes is not. The state changes after saving an invalid value that is rejected by the api: I'm just figuring out how everything works. My opinion is: The bug is around line 345 of states.js.
rolledBack is called, errors are cleared and a call to becameValid is triggered by that. That's the reason why it stays dirty: uncommitted = dirty After rollback keeping it dirty makes no sense.
That is what the first plus second rollback does put in one place. Trigger the transition to loaded.saved. |
I was probably too quick to judge this as a dupe of #3498. |
Sounds like @RobIsHere is right, I can see what is happening here. I will try to work on a fix tomorrow morning. |
Closes emberjs#3499 (cherry picked from commit 6df92d4)
Steps to reproduce:
If I call model.rollbackAttributes() twice hasDirtyAttributes == false. Also, my models value do appear to be reset.. meaning the changes are reverted but hasDirtyAttributes reflects incorrectly.
DEBUG: -------------------------------
ember.debug.js:5361DEBUG: Ember : 1.13.2
ember.debug.js:5361DEBUG: Ember Data : 1.13.4
ember.debug.js:5361DEBUG: jQuery : 1.11.3
ember.debug.js:5361DEBUG: Ember Simple Auth : 0.8.0
ember.debug.js:5361DEBUG: Ember Simple Auth Cookie Store : 0.8.0
ember.debug.js:5361DEBUG: Ember Simple Auth OAuth 2.0 : 0.8.0
ember.debug.js:5361DEBUG: -------------------------------
The text was updated successfully, but these errors were encountered: