From fbef9675929e84d05708d4317704ade3f4f3a732 Mon Sep 17 00:00:00 2001 From: Jeri Peier Date: Mon, 12 Feb 2024 16:45:42 +0100 Subject: [PATCH] fix(sbb-select): wait for shadow DOM readiness before setup when using nextjs (#2409) --- src/components/select/select.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 3cea9cd05b..4c8b5531c6 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -254,8 +254,9 @@ export class SbbSelectElement extends UpdateScheduler(LitElement) { // which is done after hydration is finished. Due to this we intercept this call // in overriding removeAttribute to finish initialization of the sbb-select. // https://github.com/lit/lit/blob/main/packages/react/src/create-component.ts#L293-L296 + // We also need to wait for update complete in order to be sure that the shadow DOM has been rendered. if (isNextjs() && qualifiedName === 'defer-hydration' && !this._didLoad) { - this._setupSelect(); + this.updateComplete.then(() => this._setupSelect()); } super.removeAttribute(qualifiedName); }