Skip to content

Commit

Permalink
[cleanup] Remove unnecessary unconstrainedWidth var/check
Browse files Browse the repository at this point in the history
- it literally isn't doing anything as a check 🤷
  • Loading branch information
cee-chen committed Sep 25, 2024
1 parent a773651 commit f2f4926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ export const EuiDataGridBodyVirtualized: FunctionComponent<EuiDataGridBodyProps>
*/
const { finalWidth, finalHeight } = useFinalGridDimensions({
unconstrainedHeight,
unconstrainedWidth: 0, // unable to determine this until the container's size is known
wrapperDimensions,
wrapperRef,
isFullScreen,
Expand Down
11 changes: 3 additions & 8 deletions packages/eui/src/components/datagrid/utils/grid_height_width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ import { DataGridSortedContext } from './sorting';

export const useFinalGridDimensions = ({
unconstrainedHeight,
unconstrainedWidth,
wrapperDimensions,
wrapperRef,
isFullScreen,
rowCount,
}: {
unconstrainedHeight: number;
unconstrainedWidth: number;
wrapperDimensions: { width: number; height: number };
wrapperRef: MutableRefObject<HTMLDivElement | null>;
isFullScreen: boolean;
Expand Down Expand Up @@ -69,16 +67,13 @@ export const useFinalGridDimensions = ({
useEffect(() => {
if (!wrapperRef.current) return;
const wrapperWidth = wrapperRef.current.getBoundingClientRect().width;

if (wrapperWidth !== unconstrainedWidth) {
setWidth(wrapperWidth);
}
}, [wrapperDimensions.width, unconstrainedWidth, wrapperRef]);
setWidth(wrapperWidth);
}, [wrapperDimensions.width, wrapperRef]);

const finalHeight = isFullScreen
? fullScreenHeight
: height || unconstrainedHeight;
const finalWidth = width || unconstrainedWidth;
const finalWidth = width || 0;

return IS_JEST_ENVIRONMENT
? {
Expand Down

0 comments on commit f2f4926

Please sign in to comment.