Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sbb-select): fix hydration timing issue #2301

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class SbbSelectElement extends UpdateScheduler(LitElement) {

// Wait for ssr hydration
this.startUpdate();
if (!isNextjs()) {
if (!isNextjs() || !this.hasAttribute('defer-hydration')) {
this._setupSelect();
}
}
Expand All @@ -256,7 +256,7 @@ 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
if (isNextjs() && qualifiedName === 'defer-hydration') {
if (isNextjs() && qualifiedName === 'defer-hydration' && this.hasUpdated) {
this._setupSelect();
}
super.removeAttribute(qualifiedName);
Expand Down