Use useMemo for callback passed to SarifLocation.onClick in AlertTableResultRow
This commit is contained in:
@@ -42,6 +42,10 @@ export function AlertTableResultRow(props: Props) {
|
|||||||
[resultIndex],
|
[resultIndex],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleSarifLocationClicked = useMemo(
|
||||||
|
() => updateSelectionCallback(resultKey),
|
||||||
|
[resultKey, updateSelectionCallback],
|
||||||
|
);
|
||||||
const handleDropdownClick = useMemo(() => {
|
const handleDropdownClick = useMemo(() => {
|
||||||
const indices =
|
const indices =
|
||||||
Keys.getAllPaths(result).length === 1
|
Keys.getAllPaths(result).length === 1
|
||||||
@@ -83,7 +87,7 @@ export function AlertTableResultRow(props: Props) {
|
|||||||
loc={result.locations[0]}
|
loc={result.locations[0]}
|
||||||
sourceLocationPrefix={sourceLocationPrefix}
|
sourceLocationPrefix={sourceLocationPrefix}
|
||||||
databaseUri={databaseUri}
|
databaseUri={databaseUri}
|
||||||
onClick={updateSelectionCallback(resultKey)}
|
onClick={handleSarifLocationClicked}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user