fix: dialog import and video height fix

This commit is contained in:
JohnMark Sill 2022-02-18 20:46:04 -06:00
parent 0c07eccbd1
commit f671b99c52
2 changed files with 7 additions and 15 deletions

View File

@ -36,21 +36,13 @@ export const HistoryVideo = ({
const [videoHeight, setVideoHeight] = useState<number>(undefined); const [videoHeight, setVideoHeight] = useState<number>(undefined);
const [videoProperties, setVideoProperties] = useState<VideoProperties>(undefined); const [videoProperties, setVideoProperties] = useState<VideoProperties>(undefined);
const initializeVideoContainerHeight = useCallback(() => { const currentVideo = videoRef.current;
const video = videoRef.current; if (currentVideo && !videoHeight) {
const videoExists = !isNullOrUndefined(video); const currentVideoHeight = currentVideo.offsetHeight;
if (videoExists) { if (currentVideoHeight > 0) {
const videoHeight = video.offsetHeight; setVideoHeight(currentVideoHeight);
const videoHasHeight = videoHeight > 0;
if (videoHasHeight) {
setVideoHeight(videoHeight);
}
} }
}, [videoRef]); }
useEffect(() => {
initializeVideoContainerHeight();
}, [initializeVideoContainerHeight]);
useEffect(() => { useEffect(() => {
const idExists = !isNullOrUndefined(id); const idExists = !isNullOrUndefined(id);

View File

@ -1,6 +1,6 @@
import { h } from 'preact'; import { h } from 'preact';
import Dialog from '../Dialog'; import Dialog from '../Dialog';
import { fireEvent, render, screen } from '@testing-library/preact'; import { render, screen } from '@testing-library/preact';
describe('Dialog', () => { describe('Dialog', () => {
let portal; let portal;