Skip to content

Commit

Permalink
fix(sbb-select): wait for shadow DOM readiness before setup when usin…
Browse files Browse the repository at this point in the history
…g nextjs (#2409)
  • Loading branch information
jeripeierSBB committed Feb 12, 2024
1 parent 28d3459 commit fbef967
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fbef967

Please sign in to comment.