Skip to content

Commit

Permalink
add description in source code
Browse files Browse the repository at this point in the history
  • Loading branch information
jelhan committed Mar 25, 2020
1 parent f8e7ecc commit f1bcf2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addon/components/bs-form/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export default BsFormElement.extend({
hasValidator: notEmpty('model.validate'),

setupValidations() {
// `Changeset.error` is a getter based on a tracked property. Since it's a
// derived state it's not working together with computed properties smoothly.
// As a work-a-round we observe the `Changeset._errors` computed property
// directly, which holds the state. This is not optimal cause it's private.
// Should refactor to native getter as soon as `<FormElement>` component
// of Ember Bootstrap supports native getters for `FormElement.errors`
// property.
let key = `model.error.${this.get('property')}.validation`;
defineProperty(this, 'errors', computed(`model._errors`, function() {
return A(this.get(key));
Expand Down

0 comments on commit f1bcf2b

Please sign in to comment.