From 77cfd19c433935b7e0fa83a0fcb74da299e2c210 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 20 Feb 2023 09:59:49 -0800 Subject: [PATCH] Fixed: Artists table not resizing properly when window size changed (cherry picked from commit d923d3f106d30d68fd04ddae2a201de041705163) Closes #3373 --- frontend/src/Artist/Index/Table/ArtistIndexTable.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx b/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx index fb258eb26..08f5a9680 100644 --- a/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx +++ b/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx @@ -96,6 +96,8 @@ function ArtistIndexTable(props: ArtistIndexTableProps) { const listRef: React.MutableRefObject = useRef(); const [measureRef, bounds] = useMeasure(); const [size, setSize] = useState({ width: 0, height: 0 }); + const windowWidth = window.innerWidth; + const windowHeight = window.innerHeight; const rowHeight = useMemo(() => { return showBanners ? 70 : 38; @@ -106,8 +108,8 @@ function ArtistIndexTable(props: ArtistIndexTableProps) { if (isSmallScreen) { setSize({ - width: window.innerWidth, - height: window.innerHeight, + width: windowWidth, + height: windowHeight, }); return; @@ -120,10 +122,10 @@ function ArtistIndexTable(props: ArtistIndexTableProps) { setSize({ width: width - padding * 2, - height: window.innerHeight, + height: windowHeight, }); } - }, [isSmallScreen, scrollerRef, bounds]); + }, [isSmallScreen, windowWidth, windowHeight, scrollerRef, bounds]); useEffect(() => { const currentScrollListener = isSmallScreen ? window : scrollerRef.current;