Skip to content

Commit 5759e1b

Browse files
authored
fix(SimplifiedPlan): should hide dividers if item is collapsed (#1124)
1 parent 68c3972 commit 5759e1b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Divider({modifiers, left}: DividerProps) {
3333
);
3434
}
3535

36-
function getDividers(lines: string, hasLeafs: boolean) {
36+
function getDividers(lines: string, hasVisibleSubNodes: boolean) {
3737
const linesArray = lines.split('.').map(Number);
3838
const dividers = [];
3939
for (let i = 0; i < linesArray.length; i++) {
@@ -61,7 +61,7 @@ function getDividers(lines: string, hasLeafs: boolean) {
6161
);
6262
}
6363
}
64-
if (i === linesArray.length - 1 && hasLeafs) {
64+
if (i === linesArray.length - 1 && hasVisibleSubNodes) {
6565
//starting vertical line if node has leafs
6666
dividers.push(
6767
<Divider
@@ -82,9 +82,12 @@ function getDividers(lines: string, hasLeafs: boolean) {
8282
export function OperationCell<TData>({row, depth = 0, params}: OperationCellProps<TData>) {
8383
const {name, operationParams, lines = ''} = params;
8484

85-
const hasLeafs = row.getLeafRows().length > 0;
85+
const hasVisibleSubNodes = row.getLeafRows().length > 0 && row.getIsExpanded();
8686

87-
const dividers = React.useMemo(() => getDividers(lines, hasLeafs), [lines, hasLeafs]);
87+
const dividers = React.useMemo(
88+
() => getDividers(lines, hasVisibleSubNodes),
89+
[lines, hasVisibleSubNodes],
90+
);
8891

8992
return (
9093
<div

0 commit comments

Comments
 (0)