Skip to content

Commit 48c2d2c

Browse files
authored
Merge pull request #118 from github/reattach_on_mutate
Reattach state when child elements change
2 parents dcbc8f3 + eae8e75 commit 48c2d2c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/auto-complete-element.ts

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ export class AutoCompleteElement extends HTMLElement {
7373
connectedCallback(): void {
7474
if (!this.isConnected) return
7575
this.#reattachState()
76+
77+
new MutationObserver(() => {
78+
if (!state.get(this)) {
79+
this.#reattachState()
80+
}
81+
}).observe(this, {subtree: true, childList: true})
7682
}
7783

7884
disconnectedCallback(): void {

0 commit comments

Comments
 (0)