-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove media container observers on disconnect #1061
Conversation
@mihar-22 is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1061 +/- ##
==========================================
- Coverage 78.55% 77.49% -1.07%
==========================================
Files 59 51 -8
Lines 11080 12321 +1241
Branches 0 722 +722
==========================================
+ Hits 8704 9548 +844
- Misses 2376 2745 +369
- Partials 0 28 +28 ☔ View full report in Codecov by Sentry. |
no worries about that, I think I manually corrected that last time. Prettier is making that quite ugly :)
that's not correct, yes it is possible but it requires a manual https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/upgrade for that to happen. by default the upgrade is only done on connecting to the DOM, and the constructor will also be called at that time. LGTM! I'll leave it for 1 other person to review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been awhile since thinking about these contortionist moves 😅. I can't recall whether or not one of the motivations for doing this in the constructor was to handle the possibility of doing a "first round" computation earlier than connectedCallback
/DOM attachment (given the async crud) to reduce chances of CLS. Overall this approach makes sense to me and we can always re-solve the first pass case with this refactor if needed. AKA LGMT.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Sorry I wasn't clear. I was referring to the Calling ![]() Simply appending to DOM: ![]() |
As discussed in #1057.
Apologies, not sure why it's auto-formatting the innerHTML template string, am I missing an extension or something?
To answer a few questions from the other PR:
Generally true, but not when the element is created in-memory (
document.createElement
or via template) and not yet attached to the DOM. Quite common practice in modern frameworks (e.g., Vue/Solid/Svelte).That is true but it's still best practice to clean up on disconnect. Element may be held in memory as it's being moved in the DOM, might be offloaded in a scroll container as it goes out of view, detached by a framework as a performance optimization, and many other reasons.