Skip to content

Commit a576dac

Browse files
Do all rendering in AlertTablePathRow in one place
1 parent 3e7577c commit a576dac

1 file changed

Lines changed: 30 additions & 36 deletions

File tree

extensions/ql-vscode/src/view/results/AlertTablePathRow.tsx

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,45 +49,39 @@ export function AlertTablePathRow(props: Props) {
4949
pathKey,
5050
selectedItem,
5151
);
52-
const pathRow = (
53-
<tr
54-
ref={scroller.ref(isPathSpecificallySelected)}
55-
{...selectableZebraStripe(isPathSpecificallySelected, resultIndex)}
56-
>
57-
<td className="vscode-codeql__icon-cell">
58-
<span className="vscode-codeql__vertical-rule"></span>
59-
</td>
60-
<AlertTableDropdownIndicatorCell
61-
expanded={currentPathExpanded}
62-
onClick={handleDropdownClick}
63-
/>
64-
<td className="vscode-codeql__text-center" colSpan={3}>
65-
Path
66-
</td>
67-
</tr>
68-
);
69-
70-
const pathNodeRows =
71-
currentPathExpanded &&
72-
path.locations.map((step, pathNodeIndex) => (
73-
<AlertTablePathNodeRow
74-
key={`${resultIndex}-${pathIndex}-${pathNodeIndex}`}
75-
step={step}
76-
pathNodeIndex={pathNodeIndex}
77-
pathIndex={pathIndex}
78-
resultIndex={resultIndex}
79-
selectedItem={selectedItem}
80-
databaseUri={databaseUri}
81-
sourceLocationPrefix={sourceLocationPrefix}
82-
updateSelectionCallback={updateSelectionCallback}
83-
scroller={scroller}
84-
/>
85-
));
8652

8753
return (
8854
<>
89-
{pathRow}
90-
{pathNodeRows}
55+
<tr
56+
ref={scroller.ref(isPathSpecificallySelected)}
57+
{...selectableZebraStripe(isPathSpecificallySelected, resultIndex)}
58+
>
59+
<td className="vscode-codeql__icon-cell">
60+
<span className="vscode-codeql__vertical-rule"></span>
61+
</td>
62+
<AlertTableDropdownIndicatorCell
63+
expanded={currentPathExpanded}
64+
onClick={handleDropdownClick}
65+
/>
66+
<td className="vscode-codeql__text-center" colSpan={3}>
67+
Path
68+
</td>
69+
</tr>
70+
{currentPathExpanded &&
71+
path.locations.map((step, pathNodeIndex) => (
72+
<AlertTablePathNodeRow
73+
key={`${resultIndex}-${pathIndex}-${pathNodeIndex}`}
74+
step={step}
75+
pathNodeIndex={pathNodeIndex}
76+
pathIndex={pathIndex}
77+
resultIndex={resultIndex}
78+
selectedItem={selectedItem}
79+
databaseUri={databaseUri}
80+
sourceLocationPrefix={sourceLocationPrefix}
81+
updateSelectionCallback={updateSelectionCallback}
82+
scroller={scroller}
83+
/>
84+
))}
9185
</>
9286
);
9387
}

0 commit comments

Comments
 (0)