Skip to content

Commit

Permalink
OCPBUGS-27152: Fix popover jump in Tables
Browse files Browse the repository at this point in the history
  • Loading branch information
rawagner committed Jan 19, 2024
1 parent 4b79e2b commit c274cde
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions frontend/public/components/factory/Table/VirtualizedTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@ type VirtualizedTableBodyProps<D, R = {}> = {
getRowClassName?: (obj: D) => string;
};

const RowMemo = React.memo<RowProps<any, any> & { Row: React.ComponentType<RowProps<any, any>> }>(
({ Row, ...props }) => <Row {...props} />,
const RowMemo = React.memo<
RowProps<any, any> & {
Row: React.ComponentType<RowProps<any, any>>;
isScrolling: boolean;
style: React.CSSProperties;
}
>(
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
({ Row, isScrolling, style, ...props }) => <Row {...props} />,
(_, nextProps) => {
if (nextProps.isScrolling) {
return true;
}
},
);

const VirtualizedTableBody = <D extends any, R extends any = {}>({
Expand Down Expand Up @@ -73,7 +85,7 @@ const VirtualizedTableBody = <D extends any, R extends any = {}>({
title={getRowTitle?.(rowArgs.obj)}
className={getRowClassName?.(rowArgs.obj)}
>
<RowMemo Row={Row} {...rowArgs} />
<RowMemo Row={Row} {...rowArgs} style={style} isScrolling={isScrolling} />
</TableRow>
</CellMeasurer>
);
Expand Down

0 comments on commit c274cde

Please sign in to comment.