Skip to content

Commit 5887100

Browse files
committed
fix: additional waitForUpdateComplete in async dialogs
1 parent cb2daf5 commit 5887100

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

components/dialog/dialog-mixin.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
149149
});
150150
}
151151

152+
async waitForUpdateComplete() {
153+
const predicate = () => true;
154+
const composedChildren = getComposedChildren(this, predicate);
155+
await Promise.all(composedChildren.map(child => waitForElem(child, predicate)));
156+
}
157+
152158
_addHandlers() {
153159
window.addEventListener('resize', this._updateSize);
154160
this.addEventListener('touchstart', this._handleTouchStart);
@@ -455,7 +461,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
455461

456462
const flag = window.D2L?.LP?.Web?.UI?.Flags.Flag('GAUD-7397-dialog-resize-update-complete', true) ?? true;
457463
if (flag) {
458-
await this.#waitForUpdateComplete();
464+
await this.waitForUpdateComplete();
459465
await this._updateSize();
460466
}
461467
/** Dispatched when the dialog is opened */
@@ -587,9 +593,4 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
587593
});
588594
}
589595

590-
async #waitForUpdateComplete() {
591-
const predicate = () => true;
592-
const composedChildren = getComposedChildren(this, predicate);
593-
await Promise.all(composedChildren.map(child => waitForElem(child, predicate)));
594-
}
595596
};

components/dialog/dialog.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
205205
super.updated(changedProperties);
206206
if (!changedProperties.has('asyncState')) return;
207207
if (this.asyncState === asyncStates.complete) {
208-
this.resize();
208+
const flag = window.D2L?.LP?.Web?.UI?.Flags.Flag('GAUD-7397-dialog-resize-update-complete', true) ?? true;
209+
if (flag) {
210+
this.waitForUpdateComplete().then(() => this.resize());
211+
} else {
212+
this.resize();
213+
}
209214
}
210215
}
211216

0 commit comments

Comments
 (0)