Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix video call persisting when widget removed
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#15703
Type: defect
  • Loading branch information
dbkr committed Aug 12, 2021
1 parent fbc5729 commit 657dcaf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/stores/WidgetStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
if (edited && !this.roomMap.has(room.roomId)) {
this.roomMap.set(room.roomId, roomInfo);
}

// If a persistent widget is active, check to see if it's just been removed.
// If it has, it needs to destroyed otherwise unmounting the node won't kill it
const persistentWidgetId = ActiveWidgetStore.getPersistentWidgetId();
if (persistentWidgetId) {
if (
ActiveWidgetStore.getRoomId(persistentWidgetId) === room.roomId &&
!roomInfo.widgets.some(w => w.id === persistentWidgetId)
) {
console.log(`Persistent widget ${persistentWidgetId} removed from room ${room.roomId}: destroying.`);
ActiveWidgetStore.destroyPersistentWidget(persistentWidgetId);
}
}

/*if (
oldWidgetIds.includes(ActiveWidgetStore.getPersistentWidgetId()) &&
!roomInfo.widgets.map(w => w.id).includes(ActiveWidgetStore.getPersistentWidgetId())) {
ActiveWidgetStore.destroyPersistentWidget(ActiveWidgetStore.getPersistentWidgetId());
}*/

this.emit(room.roomId);
}

Expand Down

0 comments on commit 657dcaf

Please sign in to comment.