-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
rollbackInvalid & rollbackProperty functions #179
rollbackInvalid & rollbackProperty functions #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just a minor comment! Thanks :)
|
||
```js | ||
changeset.rollback(); // returns changeset | ||
``` | ||
|
||
**[⬆️ back to top](#api)** | ||
|
||
#### `rollbackInvalid` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add an entry in the API
TOC above?
Oops! Missed a spot -- fixed now. :P Thanks for taking a look! |
Thanks @XaserAcheron was just looking for a way to rollback a single attribute. |
Glad to help! At risk of slight annoyance, pinging @poteto for re-review. Should all be kosher now. |
Just checking back in on this -- dropping off my monthly @poteto ping, I suppose. :P |
Anything we can do to get this landed? |
It's really unfortunate this has been delayed for nearly a year because of a single-line documentation issue that was corrected within a day. 9_6 |
Will try to take a look at this over the weekend (but no promises since other things might come up). Sorry it's taken so long! |
@XaserAcheron would you mind rebasing this so it's ready to go? |
Happy 1-year anniversary, everyone. D: I've made this merge-able again, but there's a bunch of new stuff (relayCache & Flow types) in the base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can definitely see the use case here for finer grain control, esp for complex use cases.
@XaserAcheron You have done a lot, so sry to make one more request...Could you merge master in one last time (to make sure master is a-ok) with your branch and we will merge this in tomorrow as long as the tests pass! 🎉
Merged n' pushed. Tests worked on my end -- we'll see if Travis behaves today. :P |
Woohoo! Thanks there. |
Though I'm pretty over the moon about this addon's approach to validations, I ran into a case where I needed to ditch all invalid changes and keep (+execute) just the valid ones, but couldn't find a good way to do it with the provided API.
To that extent, here's two new functions:
rollbackInvalid()
, which rolls back just the changes that fail validation, androllbackProperty(key)
, which rolls back a single property by name (closes Supportrollback
for individual properties #142).Tests and docs included.
I was a bit unsure whether to make
rollbackProperty
a new function or just extendrollback
to optionally accept a key parameter (similar tovalidate
) -- I went the new function route, but will update it to go the other way if desired.