Commit 1ad6814
fix: guard disconnectedCallback against undefined aplayer and prevent duplicate initialization (#105)
- Add null check for this.aplayer in disconnectedCallback to prevent
'Cannot read properties of undefined (reading destroy)' error when
the element is moved in the DOM before the async fetch completes
- Add _initialized flag to prevent connectedCallback from running
_init() and _parse() multiple times when the element is re-inserted
into the DOM (e.g., by jQuery DOM manipulation libraries)
- Reset _initialized on proper disconnect so the element can be reused
Fixes #66
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: METO <metowolf@users.noreply.github.com>1 parent f1ed5a9 commit 1ad6814
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
0 commit comments