From 051142e00be2f9cb70e93335e95d8b4fdfb7ef0f Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 14 Apr 2026 16:04:23 -0500 Subject: [PATCH] Some perf things --- src/components/images/Gallery/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/images/Gallery/index.tsx b/src/components/images/Gallery/index.tsx index 29cf4d88af..f14e8b5913 100644 --- a/src/components/images/Gallery/index.tsx +++ b/src/components/images/Gallery/index.tsx @@ -2,6 +2,7 @@ import { cloneElement, createContext, useContext, + useEffect, useMemo, useRef, useState, @@ -331,8 +332,13 @@ function GalleryImage({ ) const dims = computeDims({height, aspectRatio}) - onWidthChange(index, dims.width) - onContainerRef(index, containerRef) + useEffect(() => { + onWidthChange(index, dims.width) + }, [index, dims.width, onWidthChange]) + + useEffect(() => { + onContainerRef(index, containerRef) + }, [index, containerRef, onContainerRef]) return (