fix(form-registrar-mixin): ensure becomesReady called only once
This commit is contained in:
parent
75b3e2c92f
commit
991af25d87
1 changed files with 5 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.__hasBeenRenedered = false;
|
||||||
this.registrationReady = new Promise(resolve => {
|
this.registrationReady = new Promise(resolve => {
|
||||||
this.__resolveRegistrationReady = resolve;
|
this.__resolveRegistrationReady = resolve;
|
||||||
});
|
});
|
||||||
|
|
@ -38,7 +39,9 @@ export const FormRegistrarMixin = dedupeMixin(
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
}
|
}
|
||||||
formRegistrarManager.add(this);
|
formRegistrarManager.add(this);
|
||||||
formRegistrarManager.becomesReady(this);
|
if (this.__hasBeenRenedered) {
|
||||||
|
formRegistrarManager.becomesReady(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
|
|
@ -57,6 +60,7 @@ export const FormRegistrarMixin = dedupeMixin(
|
||||||
this.__resolveRegistrationReady();
|
this.__resolveRegistrationReady();
|
||||||
this.__readyForRegistration = true;
|
this.__readyForRegistration = true;
|
||||||
formRegistrarManager.becomesReady(this);
|
formRegistrarManager.becomesReady(this);
|
||||||
|
this.__hasBeenRenedered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFormElement(child) {
|
addFormElement(child) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue