fix(sidekick-area): avoid rendering into an unmounted root on re-registration - #136
Open
Arthurk12 wants to merge 1 commit into
Open
fix(sidekick-area): avoid rendering into an unmounted root on re-registration#136Arthurk12 wants to merge 1 commit into
Arthurk12 wants to merge 1 commit into
Conversation
…stration Changing the client's display language while the "Pick random user" sidekick panel is open crashes the client with "Cannot update an unmounted root.", thrown from React's ReactDOMRoot.render (issue bigbluebutton#135). contentFunction caches the {element, root} pair it creates and reuses the cached root whenever the client calls it again for the same container, to avoid detaching the previously rendered tree. However, the client also owns that root's lifecycle: it can unmount the root it was handed and then invoke contentFunction again for the same container, which happens while processing the re-registration this plugin triggers whenever its effect reruns for a new intl (i.e. a language switch). The cache had no way to notice the root had already been unmounted, so it kept calling render on a dead root. Wrap the created root so unmount() also clears the cached entry, forcing the next contentFunction call for that element to create a fresh root instead of reusing the stale one.
AtilaU19
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Changing the client's display language while the "Pick random user" sidekick panel is open crashes the client with "Cannot update an unmounted root.", thrown from React's ReactDOMRoot.render (issue #135).
contentFunction caches the {element, root} pair it creates and reuses the cached root whenever the client calls it again for the same container, to avoid detaching the previously rendered tree. However, the client also owns that root's lifecycle: it can unmount the root it was handed and then invoke contentFunction again for the same container, which happens while processing the re-registration this plugin triggers whenever its effect reruns for a new intl (i.e. a language switch). The cache had no way to notice the root had already been unmounted, so it kept calling render on a dead root.
Wrap the created root so unmount() also clears the cached entry, forcing the next contentFunction call for that element to create a fresh root instead of reusing the stale one.
Closes Issue(s)
Closes #135