diff --git a/web/src/components/HistoryViewer/HistoryVideo.tsx b/web/src/components/HistoryViewer/HistoryVideo.tsx index b08611b95..8723caccb 100644 --- a/web/src/components/HistoryViewer/HistoryVideo.tsx +++ b/web/src/components/HistoryViewer/HistoryVideo.tsx @@ -36,21 +36,13 @@ export const HistoryVideo = ({ const [videoHeight, setVideoHeight] = useState(undefined); const [videoProperties, setVideoProperties] = useState(undefined); - const initializeVideoContainerHeight = useCallback(() => { - const video = videoRef.current; - const videoExists = !isNullOrUndefined(video); - if (videoExists) { - const videoHeight = video.offsetHeight; - const videoHasHeight = videoHeight > 0; - if (videoHasHeight) { - setVideoHeight(videoHeight); - } + const currentVideo = videoRef.current; + if (currentVideo && !videoHeight) { + const currentVideoHeight = currentVideo.offsetHeight; + if (currentVideoHeight > 0) { + setVideoHeight(currentVideoHeight); } - }, [videoRef]); - - useEffect(() => { - initializeVideoContainerHeight(); - }, [initializeVideoContainerHeight]); + } useEffect(() => { const idExists = !isNullOrUndefined(id); diff --git a/web/src/components/__tests__/Dialog.test.jsx b/web/src/components/__tests__/Dialog.test.jsx index 7b303163a..24852e1ff 100644 --- a/web/src/components/__tests__/Dialog.test.jsx +++ b/web/src/components/__tests__/Dialog.test.jsx @@ -1,6 +1,6 @@ import { h } from 'preact'; import Dialog from '../Dialog'; -import { fireEvent, render, screen } from '@testing-library/preact'; +import { render, screen } from '@testing-library/preact'; describe('Dialog', () => { let portal;