From 62fecf04034254525949c1cd269d5f4d7fcab8bb Mon Sep 17 00:00:00 2001 From: Rafael Date: Tue, 26 Apr 2022 16:53:59 -0300 Subject: [PATCH] Fix broken player state when app is updated and resize failed --- ui/component/fileRenderFloating/view.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/component/fileRenderFloating/view.jsx b/ui/component/fileRenderFloating/view.jsx index 79c61f076..de1798034 100644 --- a/ui/component/fileRenderFloating/view.jsx +++ b/ui/component/fileRenderFloating/view.jsx @@ -139,6 +139,7 @@ export default function FileRenderFloating(props: Props) { y: window.innerHeight - 400, }); const relativePosRef = React.useRef({ x: 0, y: 0 }); + const noPlayerHeight = fileViewerRect?.height === 0; const navigateUrl = (playingPrimaryUri || playingUrl || '') + (collectionId ? generateListSearchUrlParams(collectionId) : ''); @@ -244,10 +245,10 @@ export default function FileRenderFloating(props: Props) { }, [channelUrl, claimId, doCommentSocketConnect, doCommentSocketDisconnect, isCurrentClaimLive, uri]); React.useEffect(() => { - if (playingPrimaryUri || playingUrl) { + if (playingPrimaryUri || playingUrl || noPlayerHeight) { handleResize(); } - }, [handleResize, playingPrimaryUri, theaterMode, playingUrl]); + }, [handleResize, playingPrimaryUri, theaterMode, playingUrl, noPlayerHeight]); // Listen to main-window resizing and adjust the floating player position accordingly: React.useEffect(() => { @@ -587,7 +588,8 @@ const PlayerGlobalStyles = (props: GlobalStylesProps) => { 0 ? `${heightResult} !important` : undefined, opacity: !theaterMode && mainFilePlaying ? '0 !important' : undefined, },