-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
PaperForm throwing backtracking assertion 3.16 + #1127
Comments
A monkey-patch or quick fix is to rewrite the isInvalid and isTouched computeds to normal props that are setted by observers using scheduleOnce. import PaperForm from "ember-paper/components/paper-form";
import { observes } from "@ember-decorators/object";
import { scheduleOnce } from "@ember/runloop";
export default class PaperFormComponent extends PaperForm {
isInvalid = null;
isTouched = null;
setProp(key) {
this.set(key, this.get("childComponents").isAny(key));
}
@observes("[email protected]")
isInvalidObserver() {
scheduleOnce("afterRender", this, this.setProp.bind(this, "isInvalid"));
}
@observes("[email protected]")
isTouchedObserver() {
scheduleOnce("afterRender", this, this.setProp.bind(this, "isTouched"));
}
} |
This is indeed a problem. I'd just like to point out another workaround that is just using <PaperForm as |form|>
<form.input @onChange={{action (mut this.value)}} @value={{this.value}} @required={{true}}/>
{{#if form.isInvalid}}
This form is invalid
{{/if}}
</PaperForm> Not sure how to fix this the correct way since this is, by definition, something that depends on things rendered "afterwards". |
Yes, I'm not sure either how to refactor this... maybe we could ask @pzuraq for advice |
I found the same assertion error when trying to implement a similar logic to |
I think the init func in childMixin could have afterRender... import { scheduleOnce } from "@ember/runloop";
export default Mixin.create({
init() {
this._super(...arguments);
if (this.get('parentComponent')) {
let fn = () => {this.get('parentComponent').register(this)}
scheduleOnce('afterRender', this, fn);
}
},
}); |
Any updates on this ? For what it's worth, I think the correct way to handle all this parent/child nightmare is through events. |
Hello, trying to upgrade to 3.16.2 but got this error, starting from 3.16.0 AFAIK.
Related PR: emberjs/ember.js#18554
Throws
The text was updated successfully, but these errors were encountered: