Open
Description
Hi,
I have a use case where I need to rollback all attributes of a model to their last saved state. In the code of the JsonApiModel I found the method rollbackAttributes()
which I excpected to do the job. But when doing two changes on a model attribute it only rolls back one change and not two changes.
Example:
let test = this.datastoreService.createRecord(Role, {});
test.name = "test";
test.save();
console.log(test.name); // prints "test"
test.name = "test2";
test.name = "test22";
test.rollbackAttributes();
console.log(test.name); //prints "test2" but I expected it to print "test"
Is this a bug or expected behaviour? If it's a bug I would like to propose a fix in the saveAnnotations()
method of the Attribute decorator and make a pull request.