Skip to content

fix: guard disconnectedCallback against undefined aplayer and prevent…#105

Merged
metowolf merged 1 commit intomasterfrom
cursor/fix-disconnected-callback-crash-289b
Apr 12, 2026
Merged

fix: guard disconnectedCallback against undefined aplayer and prevent…#105
metowolf merged 1 commit intomasterfrom
cursor/fix-disconnected-callback-crash-289b

Conversation

@metowolf
Copy link
Copy Markdown
Owner

… duplicate initialization

  • 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

… duplicate initialization

- 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: METO <metowolf@users.noreply.github.com>
@metowolf metowolf merged commit 1ad6814 into master Apr 12, 2026
3 checks passed
@metowolf metowolf deleted the cursor/fix-disconnected-callback-crash-289b branch April 12, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MetingJS v2.0.1 与 overlayscrollbars@1.13.1 存在冲突?

2 participants