From 0be0083597deabc028ab805d14dda1543c5d65ed Mon Sep 17 00:00:00 2001 From: aaronmcouture Date: Mon, 6 Mar 2017 14:13:52 -0500 Subject: [PATCH] Upgrade to be complaint with 2.11 Resolve "Backtracking re-render" exception by building up the errors object when the component is loaded into memory. --- addon/mixin.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addon/mixin.js b/addon/mixin.js index 2fa174f2..b8038fa2 100644 --- a/addon/mixin.js +++ b/addon/mixin.js @@ -118,6 +118,17 @@ export default Mixin.create(setValidityMixin, { this.buildValidators(); this.validators.forEach((validator) => { + let names = validator.property.split('.'); + let objectPointer = this.errors; + for (let i = 0; i < names.length; i++) { + let newObjectPointer = objectPointer[names[i]]; + if (newObjectPointer === undefined) { + newObjectPointer = emberArray(); + set(objectPointer, names[i], newObjectPointer); + } + objectPointer = newObjectPointer; + } + validator.addObserver('errors.[]', this, function(sender) { let errors = emberArray();