Skip to content

Commit 3983087

Browse files
Use useMemo for callback passed to SarifLocation.onClick in AlertTableResultRow
1 parent 636d0bf commit 3983087

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export function AlertTableResultRow(props: Props) {
4242
[resultIndex],
4343
);
4444

45+
const handleSarifLocationClicked = useMemo(
46+
() => updateSelectionCallback(resultKey),
47+
[resultKey, updateSelectionCallback],
48+
);
4549
const handleDropdownClick = useMemo(() => {
4650
const indices =
4751
Keys.getAllPaths(result).length === 1
@@ -83,7 +87,7 @@ export function AlertTableResultRow(props: Props) {
8387
loc={result.locations[0]}
8488
sourceLocationPrefix={sourceLocationPrefix}
8589
databaseUri={databaseUri}
86-
onClick={updateSelectionCallback(resultKey)}
90+
onClick={handleSarifLocationClicked}
8791
/>
8892
)}
8993
</td>

0 commit comments

Comments
 (0)