From 1e9cac45699f72f89450cf0bbce131a80363615c Mon Sep 17 00:00:00 2001 From: Julius Walther <juliuswalther1991@googlemail.com> Date: Thu, 20 Jun 2024 10:11:47 +0200 Subject: [PATCH] fix: select & tab-bar, trigger slotchange on hydration --- packages/ui-library/src/components/select/index.ts | 6 +++++- packages/ui-library/src/components/tab-bar/index.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/ui-library/src/components/select/index.ts b/packages/ui-library/src/components/select/index.ts index 133202cf5..09e13294b 100644 --- a/packages/ui-library/src/components/select/index.ts +++ b/packages/ui-library/src/components/select/index.ts @@ -1,4 +1,4 @@ -import { html, nothing } from 'lit'; +import { PropertyValueMap, html, nothing } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; import { query, state } from 'lit/decorators.js'; import { property } from '../../utils/lit/decorators.js'; @@ -82,6 +82,10 @@ export class BlrSelect extends LitElementCustom { } }; + protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void { + this.handleSlotChange(); + } + protected handleSlotChange() { const slot = this.renderRoot?.querySelector('slot'); diff --git a/packages/ui-library/src/components/tab-bar/index.ts b/packages/ui-library/src/components/tab-bar/index.ts index abac0ae5d..b46a9e0f2 100644 --- a/packages/ui-library/src/components/tab-bar/index.ts +++ b/packages/ui-library/src/components/tab-bar/index.ts @@ -1,5 +1,5 @@ /* eslint-disable lit/binding-positions */ -import { html, nothing } from 'lit'; +import { PropertyValueMap, html, nothing } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; import { query, queryAll, state } from 'lit/decorators.js'; import { property } from '../../utils/lit/decorators.js'; @@ -94,6 +94,10 @@ export class BlrTabBar extends LitElementCustom { } } + protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void { + this.handleSlotChange(); + } + protected handleSlotChange() { const slot = this.renderRoot?.querySelector('slot');