Skip to content
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

Use direct element reference when updating render container #5047

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

grant-cleary
Copy link
Contributor

This was still generating some console errors under some circumstances when an html-block was relatively quickly rendered and then updated again in quick succession. Here's what I think is happening: Before our async renderers can act, Lit is wiping out the value of the ref during its re-render. This leads to NREs in various places, since our renderers also do a bunch of asnyc things, so this can cause failures in a number of places.

While I could do something like const renderContainer = this._renderContainerRef.value to snag a direct reference to the element instead, I also think that throws away basically all of the value of using the ref directive anyways. 🤷

Let me know if you would find it preferable for me to switch to the above, but for now I think it makes more sense to just use a querySelector.

@grant-cleary grant-cleary requested a review from a team as a code owner October 4, 2024 19:33
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-5047/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@grant-cleary grant-cleary merged commit bbd9d9d into main Oct 7, 2024
6 checks passed
@grant-cleary grant-cleary deleted the gcleary/HtmlBlockMathJaxRendering branch October 7, 2024 14:33
Copy link

🎉 This PR is included in version 3.49.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants