diff --git a/src/hooks/useHeights.tsx b/src/hooks/useHeights.tsx index b4c6955..bea8a05 100644 --- a/src/hooks/useHeights.tsx +++ b/src/hooks/useHeights.tsx @@ -33,6 +33,8 @@ export default function useHeights( cancelRaf(); const doCollect = () => { + let changed = false; + instanceRef.current.forEach((element, key) => { if (element && element.offsetParent) { const htmlElement = findDOMNode(element); @@ -45,12 +47,15 @@ export default function useHeights( if (heightsRef.current.get(key) !== totalHeight) { heightsRef.current.set(key, totalHeight); + changed = true; } } }); // Always trigger update mark to tell parent that should re-calculate heights when resized - setUpdatedMark((c) => c + 1); + if (changed) { + setUpdatedMark((c) => c + 1); + } }; if (sync) {