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.
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 BufferedChangeset, mirroring the behavior in the newer ValidatedChangeset, and opening the door for an ember-changeset PR making this interface public.
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.https://github.com/poteto/ember-changeset/issues/361 https://github.com/poteto/ember-changeset/issues/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 anisValid = false
state.This PR adds
removeError
andremoveErrors
to BufferedChangeset, mirroring the behavior in the newer ValidatedChangeset, and opening the door for anember-changeset
PR making this interface public.This also should address #170