Skip to content

Commit aea1f57

Browse files
committed
fix(dashboard): restore row drop zone height tracking on child resize
1 parent 6319267 commit aea1f57

File tree

1 file changed

+9
-16
lines changed
  • superset-frontend/src/dashboard/components/gridComponents/Row

1 file changed

+9
-16
lines changed

superset-frontend/src/dashboard/components/gridComponents/Row/Row.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
useCallback,
2323
useRef,
2424
useEffect,
25+
useLayoutEffect,
2526
useMemo,
2627
memo,
2728
RefObject,
@@ -30,7 +31,7 @@ import cx from 'classnames';
3031
import { t } from '@apache-superset/core';
3132
import { FeatureFlag, isFeatureEnabled, JsonObject } from '@superset-ui/core';
3233
import { css, styled, SupersetTheme } from '@apache-superset/core/ui';
33-
import { Icons, Constants } from '@superset-ui/core/components';
34+
import { Icons } from '@superset-ui/core/components';
3435
import {
3536
Draggable,
3637
Droppable,
@@ -47,7 +48,6 @@ import { BACKGROUND_TRANSPARENT } from 'src/dashboard/util/constants';
4748
import { isEmbedded } from 'src/dashboard/util/isEmbedded';
4849
import { EMPTY_CONTAINER_Z_INDEX } from 'src/dashboard/constants';
4950
import { isCurrentUserBot } from 'src/utils/isBot';
50-
import { useDebouncedEffect } from '../../../../explore/exploreUtils';
5151

5252
export type RowProps = {
5353
id: string;
@@ -215,20 +215,13 @@ const Row = memo((props: RowProps) => {
215215
};
216216
}, []);
217217

218-
useDebouncedEffect(
219-
() => {
220-
const updatedHeight = containerRef.current?.clientHeight;
221-
if (
222-
editMode &&
223-
containerRef.current &&
224-
updatedHeight !== containerHeight
225-
) {
226-
setContainerHeight(updatedHeight ?? null);
227-
}
228-
},
229-
Constants.FAST_DEBOUNCE,
230-
[editMode, containerHeight],
231-
);
218+
useLayoutEffect(() => {
219+
if (!editMode) return;
220+
const updatedHeight = containerRef.current?.clientHeight;
221+
if (updatedHeight !== undefined && updatedHeight !== containerHeight) {
222+
setContainerHeight(updatedHeight);
223+
}
224+
});
232225

233226
const handleChangeFocus = useCallback((nextFocus: boolean) => {
234227
setIsFocused(Boolean(nextFocus));

0 commit comments

Comments
 (0)