fix: resolve registrationComplete via microtask to be sync

This commit is contained in:
Thomas Allmer 2020-07-28 13:58:13 +02:00
parent 4715b6b37d
commit 6b8daef509
2 changed files with 2 additions and 10 deletions

View file

@ -94,10 +94,7 @@ export const ChoiceGroupMixin = dedupeMixin(
connectedCallback() {
super.connectedCallback();
this.__registrationCompleteTimer = setTimeout(() => {
this.__resolveRegistrationComplete();
});
Promise.resolve().then(() => this.__resolveRegistrationComplete());
this.registrationComplete.then(() => {
this.__isInitialModelValue = false;
@ -110,7 +107,6 @@ export const ChoiceGroupMixin = dedupeMixin(
super.disconnectedCallback();
}
clearTimeout(this.__registrationCompleteTimer);
if (this.registrationComplete.done === false) {
this.__rejectRegistrationComplete();
}

View file

@ -154,10 +154,7 @@ export const FormGroupMixin = dedupeMixin(
connectedCallback() {
super.connectedCallback();
this.setAttribute('role', 'group');
this.__registrationCompleteTimer = setTimeout(() => {
this.__resolveRegistrationComplete();
});
Promise.resolve().then(() => this.__resolveRegistrationComplete());
this.registrationComplete.then(() => {
this.__isInitialModelValue = false;
@ -175,7 +172,6 @@ export const FormGroupMixin = dedupeMixin(
document.removeEventListener('click', this._checkForOutsideClick);
this.__hasActiveOutsideClickHandling = false;
}
clearTimeout(this.__registrationCompleteTimer);
if (this.registrationComplete.done === false) {
this.__rejectRegistrationComplete();
}