From f8f03e5db841d5c744184d0af18f1c80e72a2dd2 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 17 Apr 2023 12:35:51 +0200 Subject: [PATCH] fix(player): proper unmount --- frontend/app/components/Session/LivePlayer.tsx | 3 ++- frontend/app/player/web/WebLivePlayer.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/Session/LivePlayer.tsx b/frontend/app/components/Session/LivePlayer.tsx index 060ff1b8f..b73cf4ea9 100644 --- a/frontend/app/components/Session/LivePlayer.tsx +++ b/frontend/app/components/Session/LivePlayer.tsx @@ -71,12 +71,13 @@ function LivePlayer({ return () => { if (!location.pathname.includes('multiview') || !location.pathname.includes(usedSession.sessionId)) { + console.debug('unmount', usedSession.sessionId) playerInst?.clean?.(); // @ts-ignore default empty setContextValue(defaultContextValue) } } - }, [location.pathname]); + }, [location.pathname, usedSession.sessionId]); // LAYOUT (TODO: local layout state - useContext or something..) useEffect(() => { diff --git a/frontend/app/player/web/WebLivePlayer.ts b/frontend/app/player/web/WebLivePlayer.ts index 6bcb20fcb..8753190b5 100644 --- a/frontend/app/player/web/WebLivePlayer.ts +++ b/frontend/app/player/web/WebLivePlayer.ts @@ -90,7 +90,7 @@ export default class WebLivePlayer extends WebPlayer { clean = () => { this.incomingMessages.length = 0 this.assistManager.clean() - this.screen.clean() + this.screen?.clean?.() // @ts-ignore this.screen = undefined; super.clean()