Skip to content

Commit

Permalink
fix: prevent re-rendering during update (#2343)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB authored Jan 16, 2024
1 parent f94f721 commit b3e7a02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export class SbbBreadcrumbGroupElement extends SlotChildObserver(LitElement) {

@state() private _state?: 'collapsed' | 'manually-expanded';

@state() private _loaded = false;

private _resizeObserver = new AgnosticResizeObserver(() => this._evaluateCollapsedState());
private _abort = new ConnectedAbortController(this);
private _language = new LanguageController(this);
Expand Down Expand Up @@ -60,7 +58,7 @@ export class SbbBreadcrumbGroupElement extends SlotChildObserver(LitElement) {
protected override firstUpdated(changedProperties: PropertyValues): void {
super.firstUpdated(changedProperties);
this._resizeObserver.observe(this);
this._loaded = true;
this.toggleAttribute('data-loaded', true);
}

protected override updated(): void {
Expand Down Expand Up @@ -214,7 +212,6 @@ export class SbbBreadcrumbGroupElement extends SlotChildObserver(LitElement) {

protected override render(): TemplateResult {
setAttribute(this, 'role', 'navigation');
setAttribute(this, 'data-loaded', this._loaded);
setAttribute(this, 'data-state', this._state);

return html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const SlotChildObserver = <T extends Constructor<LitElement>>(
super.firstUpdated(changedProperties);
this._hydratedResolved = true;
this._hydratedResolve();
this.checkChildren();
Promise.resolve().then(() => this.checkChildren());
}

protected override async getUpdateComplete(): Promise<boolean> {
Expand Down

0 comments on commit b3e7a02

Please sign in to comment.