From d01457e64df197db1ef83d25f1d2fb7aa0ced90d Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 19 Jun 2024 08:52:45 -0600 Subject: [PATCH] Fix showing loading indicator when first loading a camera without previews (#12064) --- web/src/components/player/PreviewPlayer.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/components/player/PreviewPlayer.tsx b/web/src/components/player/PreviewPlayer.tsx index 82b9ca8e7..5dd8a9c91 100644 --- a/web/src/components/player/PreviewPlayer.tsx +++ b/web/src/components/player/PreviewPlayer.tsx @@ -172,6 +172,12 @@ function PreviewVideoPlayer({ const [firstLoad, setFirstLoad] = useState(true); + useEffect(() => { + if (cameraPreviews && cameraPreviews.length > 0) { + setFirstLoad(false); + } + }, [cameraPreviews]); + const [currentPreview, setCurrentPreview] = useState(initialPreview); const onPreviewSeeked = useCallback(() => {