Merge pull request #295 from JaySunSyn/fix/cached-form

fix(form-registrar-mixin): invoke becomesReady on connectedCallback
This commit is contained in:
gerjanvangeest 2019-10-14 08:16:54 +02:00 committed by GitHub
commit 8b1fabbf19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ export const FormRegistrarMixin = dedupeMixin(
super();
this.formElements = [];
this.__readyForRegistration = false;
this.__hasBeenRendered = false;
this.registrationReady = new Promise(resolve => {
this.__resolveRegistrationReady = resolve;
});
@ -38,6 +39,9 @@ export const FormRegistrarMixin = dedupeMixin(
super.connectedCallback();
}
formRegistrarManager.add(this);
if (this.__hasBeenRendered) {
formRegistrarManager.becomesReady();
}
}
disconnectedCallback() {
@ -55,7 +59,8 @@ export const FormRegistrarMixin = dedupeMixin(
super.firstUpdated(changedProperties);
this.__resolveRegistrationReady();
this.__readyForRegistration = true;
formRegistrarManager.becomesReady(this);
formRegistrarManager.becomesReady();
this.__hasBeenRendered = true;
}
addFormElement(child) {