From 11dfa2c8e13e62786d99bd8a2b4cdac1c6050ed7 Mon Sep 17 00:00:00 2001 From: ankurrsinghal Date: Wed, 30 Nov 2022 12:52:44 +0530 Subject: [PATCH] fix: flicker issue when both the min max values collide (#18547) --- app/client/src/components/autoHeightOverlay/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/client/src/components/autoHeightOverlay/index.tsx b/app/client/src/components/autoHeightOverlay/index.tsx index f5519b1384..795a9fea63 100644 --- a/app/client/src/components/autoHeightOverlay/index.tsx +++ b/app/client/src/components/autoHeightOverlay/index.tsx @@ -159,6 +159,9 @@ const AutoHeightOverlay: React.FC = memo( const finalMinY = minY + mindY; useEffect(() => { + // reset the diff on backend update + setMindY(0); + setMaxdY(0); setMaxY(maxDynamicHeight * GridDefaults.DEFAULT_GRID_ROW_HEIGHT); }, [maxDynamicHeight]); @@ -220,8 +223,6 @@ const AutoHeightOverlay: React.FC = memo( if (heightToSet === minY + mindY) { batchUpdate(heightToSet); - setMindY(0); - setMaxdY(0); } else { updateMaxHeight(heightToSet); setMaxdY(0); @@ -231,6 +232,9 @@ const AutoHeightOverlay: React.FC = memo( } useEffect(() => { + // reset the diff on backend update + setMindY(0); + setMaxdY(0); setMinY(minDynamicHeight * GridDefaults.DEFAULT_GRID_ROW_HEIGHT); }, [minDynamicHeight]); @@ -258,8 +262,6 @@ const AutoHeightOverlay: React.FC = memo( if (heightToSet === maxY + maxdY) { batchUpdate(heightToSet); - setMindY(0); - setMaxdY(0); } else { updateMinHeight(heightToSet); setMindY(0);