Merge pull request #295 from JaySunSyn/fix/cached-form
fix(form-registrar-mixin): invoke becomesReady on connectedCallback
This commit is contained in:
commit
8b1fabbf19
1 changed files with 6 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ export const FormRegistrarMixin = dedupeMixin(
|
||||||
super();
|
super();
|
||||||
this.formElements = [];
|
this.formElements = [];
|
||||||
this.__readyForRegistration = false;
|
this.__readyForRegistration = false;
|
||||||
|
this.__hasBeenRendered = false;
|
||||||
this.registrationReady = new Promise(resolve => {
|
this.registrationReady = new Promise(resolve => {
|
||||||
this.__resolveRegistrationReady = resolve;
|
this.__resolveRegistrationReady = resolve;
|
||||||
});
|
});
|
||||||
|
|
@ -38,6 +39,9 @@ export const FormRegistrarMixin = dedupeMixin(
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
}
|
}
|
||||||
formRegistrarManager.add(this);
|
formRegistrarManager.add(this);
|
||||||
|
if (this.__hasBeenRendered) {
|
||||||
|
formRegistrarManager.becomesReady();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|
@ -55,7 +59,8 @@ export const FormRegistrarMixin = dedupeMixin(
|
||||||
super.firstUpdated(changedProperties);
|
super.firstUpdated(changedProperties);
|
||||||
this.__resolveRegistrationReady();
|
this.__resolveRegistrationReady();
|
||||||
this.__readyForRegistration = true;
|
this.__readyForRegistration = true;
|
||||||
formRegistrarManager.becomesReady(this);
|
formRegistrarManager.becomesReady();
|
||||||
|
this.__hasBeenRendered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFormElement(child) {
|
addFormElement(child) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue