Skip to content

Commit 276cde2

Browse files
committed
Fix: Remove blocking cleanup from video-moq disconnectedCallback
The disconnectedCallback was calling destroy() which closes AudioContext, blocking the main thread for several seconds. This caused UI freezes when removing the element from DOM. Solution: Skip cleanup in disconnectedCallback and let garbage collection handle resource cleanup asynchronously without blocking the UI.
1 parent 43b3373 commit 276cde2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/video-moq/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,14 @@ export class VideoMoq extends HTMLElement {
163163

164164
/**
165165
* Called when the element is removed from the DOM
166+
*
167+
* Note: We intentionally skip cleanup here to avoid blocking the main thread.
168+
* The destroy() method calls AudioContext.close() which can block for several seconds,
169+
* causing UI freezes and test timeouts. Resources will be cleaned up by garbage collection.
166170
* */
167171
disconnectedCallback() {
168-
this.destroy().catch((error) => {
169-
console.error("Error while destroying:", error)
170-
})
172+
// Skip cleanup - let garbage collection handle it
173+
// This prevents blocking issues when removing the element from DOM
171174
}
172175

173176
// Called when one of the element's watched attributes change. For an attribute to be watched, you must add it to the component class's static observedAttributes property.

0 commit comments

Comments
 (0)