Skip to content
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

state is changed after save was rejected #354

Closed
alexborovkov opened this issue May 30, 2019 · 4 comments · Fixed by #567
Closed

state is changed after save was rejected #354

alexborovkov opened this issue May 30, 2019 · 4 comments · Fixed by #567

Comments

@alexborovkov
Copy link

Version

2.1.1

Steps to reproduce

Perform changeset.save(). Save was rejected.
Howewer dirty changes applied to changeset model.

@alexborovkov
Copy link
Author

I understand that this is intentional behaviour, but it doesn't feel right. For example I need to do rollback after rejection. In this scenario I need additional invoke model.rollbackAttributes

@snewcomer
Copy link
Collaborator

Thanks for reporting! Are you suggesting we should track error states and rollback attributes?

@alexborovkov
Copy link
Author

It would be nice rollback attributes if save was not succeed

@shankarsridhar
Copy link

shankarsridhar commented Jun 30, 2019

@AleksandrBorovkov
In the meanwhile you can try this workaround and see if it helps.

Call .catch() on the .save() to handle rejection and call rollback() accordingly.
You could also take take a snapshot, using the snapshot() method, before calling .save(), if you want to rollback to a more customizable state, on reject.

snewcomer added a commit that referenced this issue Dec 7, 2020
snewcomer added a commit that referenced this issue Dec 7, 2020
* #unexecute to revert changes from #save

close #354

* CHANGELOG 3.10.4

* fix test

* update github workflow

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants