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

setProperties behaviour #120

Open
denzo opened this issue Nov 10, 2017 · 2 comments
Open

setProperties behaviour #120

denzo opened this issue Nov 10, 2017 · 2 comments

Comments

@denzo
Copy link
Contributor

denzo commented Nov 10, 2017

We have a scenario where one action updates numerous properties on an object.

actions: {

  changeItemType(item, type) {
    setProperties(item, {
      type,
      options: options.findBy('type', type)
    });
  } 

}

When we call item.undo() we would expect all the attributes updates in the action to be reverted but it turns out that each attribute change is recorded as one undo.

Is there currently a way to achieve our requirement?

@denzo
Copy link
Contributor Author

denzo commented Nov 11, 2017

@offirgolan I had a play with your awesome code! And whipped up something that works #121

The new API is timemachine.beginChanges() and timemachine.endChanges() where you can make as many changes as you want but it will be undone with one step.

@denzo
Copy link
Contributor Author

denzo commented Nov 11, 2017

@offirgolan here's another approach where the undoStack is a collection of changeSets which is essentially an array of Record changes. A bit more neat I think 😉
#122

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

No branches or pull requests

1 participant