Defensive coding to reduce the risk of Maximum update depth errors (#20940)

This commit is contained in:
Jacob Richman
2026-03-03 22:32:05 -08:00
committed by GitHub
parent 6b8b62526b
commit 268d51df6b
4 changed files with 122 additions and 25 deletions
@@ -96,12 +96,15 @@ export const MaxSizedBox: React.FC<MaxSizedBoxProps> = ({
} else {
removeOverflowingId?.(id);
}
return () => {
removeOverflowingId?.(id);
};
}, [id, totalHiddenLines, addOverflowingId, removeOverflowingId]);
useEffect(
() => () => {
removeOverflowingId?.(id);
},
[id, removeOverflowingId],
);
if (effectiveMaxHeight === undefined) {
return (
<Box flexDirection="column" width={maxWidth}>