Skip to content

fix(sidekick-area): avoid rendering into an unmounted root on re-registration - #136

Open
Arthurk12 wants to merge 1 commit into
bigbluebutton:v0.1.xfrom
Arthurk12:issue/135
Open

fix(sidekick-area): avoid rendering into an unmounted root on re-registration#136
Arthurk12 wants to merge 1 commit into
bigbluebutton:v0.1.xfrom
Arthurk12:issue/135

Conversation

@Arthurk12

Copy link
Copy Markdown
Member

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

…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.
@prlanzarin
prlanzarin requested a review from AtilaU19 September 2, 2026 13:10
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.

2 participants