Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(ui): drop stale createRoot when its container is replaced

Jaya Allamsetty121b96f03a06
diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js
index 8e4894be85..e3051feca2 100644
--- a/modules/UI/videolayout/LargeVideoManager.js
+++ b/modules/UI/videolayout/LargeVideoManager.js
@@ -539,8 +539,17 @@ export default class LargeVideoManager {
return;
}
+ // If the LargeVideo subtree remounted, the cached root is bound to a now-detached
+ // node — subsequent renders would be invisible and leak. Drop the stale root so
+ // we re-create one against the live container.
+ if (this._avatarRoot && this._avatarContainer !== container) {
+ this._avatarRoot.unmount();
+ this._avatarRoot = null;
+ }
+
if (!this._avatarRoot) {
this._avatarRoot = createRoot(container);
+ this._avatarContainer = container;
}
this._avatarRoot.render(
<Provider store = { APP.store }>
diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js
index 796771f577..9d5978addd 100644
--- a/modules/UI/videolayout/VideoContainer.js
+++ b/modules/UI/videolayout/VideoContainer.js
@@ -675,8 +675,17 @@ export class VideoContainer extends LargeContainer {
return;
}
+ // If the LargeVideo subtree remounted, the cached root is bound to a now-detached
+ // node — subsequent renders would be invisible and leak. Drop the stale root so
+ // we re-create one against the live container.
+ if (this._backgroundRoot && this._backgroundContainer !== container) {
+ this._backgroundRoot.unmount();
+ this._backgroundRoot = null;
+ }
+
if (!this._backgroundRoot) {
this._backgroundRoot = createRoot(container);
+ this._backgroundContainer = container;
}
this._backgroundRoot.render(
<LargeVideoBackground