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

add #removeError and #removeErrors to Changeset interface #668

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jkeen
Copy link

@jkeen jkeen commented May 17, 2023

This is dependent on this PR being merged first, and then the validated-changeset version being bumped: validated-changeset/validated-changeset#189

The same description applies here:

I'm using ember-changeset with ember-changeset-validations with some validations where the presence requirement of one field is dependent on the value of another. If the dependent field ends up with an error and then the field it depends on changes, the error should really be cleared. But it didn't seem like there was a clean way to do that without actually rolling back the property. This seems to have come up a number of times in issues and PRs.

This seems to be something that works in the newer validated-changeset 4.x-5.x experiment, but is not something available in the classic BufferedChangeset.

#361
#282

There were some workarounds in the above threads, like effectively "clearing" an error by changeset.addError('email', null), but in my testing it still left the changeset with an isValid = false state.

This PR adds removeError and removeErrors to the Changeset interface

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 this pull request may close these issues.

1 participant