|
1 | 1 | import { LitElement, html, isServer, type TemplateResult } from 'lit'; |
2 | 2 | import { customElement } from 'lit/decorators/custom-element.js'; |
3 | 3 | import { property } from 'lit/decorators/property.js'; |
4 | | -import { state } from 'lit/decorators/state.js'; |
5 | 4 | import { classMap } from 'lit/directives/class-map.js'; |
6 | 5 |
|
7 | 6 | import { observes } from '@patternfly/pfe-core/decorators/observes.js'; |
@@ -85,7 +84,7 @@ export class PfLabelGroup extends LitElement { |
85 | 84 | @property({ reflect: true, type: Boolean }) closeable = false; |
86 | 85 |
|
87 | 86 | /** Label count tracked during SSR via child events. */ |
88 | | - @state() private _ssrLabelCount = 0; |
| 87 | + _ssrLabelCount = 0; |
89 | 88 |
|
90 | 89 | get #overflowLabel(): PfLabel | null { |
91 | 90 | return this.renderRoot?.querySelector?.<PfLabel>('#overflow') ?? null; |
@@ -138,7 +137,7 @@ export class PfLabelGroup extends LitElement { |
138 | 137 | constructor() { |
139 | 138 | super(); |
140 | 139 | this.addEventListener('remove', this.#onRemove); |
141 | | - this.addEventListener('ssr:label', this.#onSsrLabel); |
| 140 | + this.addEventListener('ssr:label', () => this._ssrLabelCount++); |
142 | 141 | } |
143 | 142 |
|
144 | 143 | override render(): TemplateResult<1> { |
@@ -207,10 +206,6 @@ export class PfLabelGroup extends LitElement { |
207 | 206 | } |
208 | 207 | } |
209 | 208 |
|
210 | | - #onSsrLabel() { |
211 | | - this._ssrLabelCount++; |
212 | | - } |
213 | | - |
214 | 209 | #updateOverflow() { |
215 | 210 | this.#labels.forEach((label, i) => { |
216 | 211 | label.hidden = i >= this.numLabels && !this.open; |
|
0 commit comments