From 3aebe754faff17a1bd3bf39cdaf8a54e6deee131 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 25 Nov 2022 10:46:12 +1100 Subject: [PATCH] Fixes unnecessary canvas scaling --- frontend/src/features/gallery/components/ImageGallery.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/gallery/components/ImageGallery.tsx b/frontend/src/features/gallery/components/ImageGallery.tsx index 826b67a048..d8e8a5a450 100644 --- a/frontend/src/features/gallery/components/ImageGallery.tsx +++ b/frontend/src/features/gallery/components/ImageGallery.tsx @@ -129,8 +129,11 @@ export default function ImageGallery() { galleryContainerRef.current ? galleryContainerRef.current.scrollTop : 0 ) ); - setTimeout(() => dispatch(setDoesCanvasNeedScaling(true)), 400); - }, [dispatch]); + setTimeout( + () => shouldPinGallery && dispatch(setDoesCanvasNeedScaling(true)), + 400 + ); + }, [dispatch, shouldPinGallery]); const handleClickLoadMore = () => { dispatch(requestImages(currentCategory));