Skip to content

Commit

Permalink
fix(SimplifiedPlan): should hide dividers if item is collapsed (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raubzeug authored Aug 7, 2024
1 parent 68c3972 commit 5759e1b
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Divider({modifiers, left}: DividerProps) {
);
}

function getDividers(lines: string, hasLeafs: boolean) {
function getDividers(lines: string, hasVisibleSubNodes: boolean) {
const linesArray = lines.split('.').map(Number);
const dividers = [];
for (let i = 0; i < linesArray.length; i++) {
Expand Down Expand Up @@ -61,7 +61,7 @@ function getDividers(lines: string, hasLeafs: boolean) {
);
}
}
if (i === linesArray.length - 1 && hasLeafs) {
if (i === linesArray.length - 1 && hasVisibleSubNodes) {
//starting vertical line if node has leafs
dividers.push(
<Divider
Expand All @@ -82,9 +82,12 @@ function getDividers(lines: string, hasLeafs: boolean) {
export function OperationCell<TData>({row, depth = 0, params}: OperationCellProps<TData>) {
const {name, operationParams, lines = ''} = params;

const hasLeafs = row.getLeafRows().length > 0;
const hasVisibleSubNodes = row.getLeafRows().length > 0 && row.getIsExpanded();

const dividers = React.useMemo(() => getDividers(lines, hasLeafs), [lines, hasLeafs]);
const dividers = React.useMemo(
() => getDividers(lines, hasVisibleSubNodes),
[lines, hasVisibleSubNodes],
);

return (
<div
Expand Down

0 comments on commit 5759e1b

Please sign in to comment.