Skip to content

Commit f8ee0ef

Browse files
authored
refactor: force Lit to perform first render synchronously (#8290)
1 parent 885d7e9 commit f8ee0ef

25 files changed

+174
-196
lines changed

packages/combo-box/src/vaadin-combo-box-mixin.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -543,17 +543,6 @@ export const ComboBoxMixin = (subclass) =>
543543
theme,
544544
itemClassNameGenerator,
545545
});
546-
547-
// NOTE: in PolylitMixin, setProperties() waits for `hasUpdated` to be set.
548-
// This means for the first opening, properties won't be set synchronously.
549-
// Call `performUpdate()` in this case to mimic the Polymer version logic.
550-
if (scroller.performUpdate && !scroller.hasUpdated) {
551-
try {
552-
scroller.performUpdate();
553-
} catch (_) {
554-
// Suppress errors in synchronous tests for pre-opened combo-box.
555-
}
556-
}
557546
}
558547
}
559548

packages/combo-box/src/vaadin-combo-box-scroller-mixin.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,6 @@ export const ComboBoxScrollerMixin = (superClass) =>
329329
el.className = '';
330330
}
331331

332-
// NOTE: in PolylitMixin, setProperties() waits for `hasUpdated` to be set.
333-
// However, this causes issues with virtualizer. So we enforce sync update.
334-
if (el.performUpdate && !el.hasUpdated) {
335-
el.performUpdate();
336-
}
337-
338332
el.id = `${this.__hostTagName}-item-${index}`;
339333
el.setAttribute('role', index !== undefined ? 'option' : false);
340334
el.setAttribute('aria-selected', selected.toString());

packages/component-base/src/polylit-mixin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ const PolylitMixinImplementation = (superclass) => {
195195
return result;
196196
}
197197

198+
static get polylitConfig() {
199+
return {
200+
asyncFirstRender: false,
201+
};
202+
}
203+
198204
constructor() {
199205
super();
200206
this.__hasPolylitMixin = true;
@@ -214,6 +220,11 @@ const PolylitMixinImplementation = (superclass) => {
214220
parentHost.$ ||= {};
215221
parentHost.$[this.id] = this;
216222
}
223+
224+
const { polylitConfig } = this.constructor;
225+
if (!this.hasUpdated && !polylitConfig.asyncFirstRender) {
226+
this.performUpdate();
227+
}
217228
}
218229

219230
/** @protected */

0 commit comments

Comments
 (0)