@@ -5,7 +5,7 @@ import { info, listUnordered } from "./octicons";
55import { ScrollIntoViewHelper } from "./scroll-into-view-helper" ;
66import { selectableZebraStripe } from "./result-table-utils" ;
77import { AlertTableDropdownIndicatorCell } from "./AlertTableDropdownIndicatorCell" ;
8- import { useMemo } from "react" ;
8+ import { useCallback , useMemo } from "react" ;
99import { SarifLocation } from "./locations/SarifLocation" ;
1010import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations" ;
1111import { AlertTablePathRow } from "./AlertTablePathRow" ;
@@ -46,15 +46,18 @@ export function AlertTableResultRow(props: Props) {
4646 ( ) => updateSelectionCallback ( resultKey ) ,
4747 [ resultKey , updateSelectionCallback ] ,
4848 ) ;
49- const handleDropdownClick = useMemo ( ( ) => {
50- const indices =
51- Keys . getAllPaths ( result ) . length === 1
52- ? [ resultKey , { ...resultKey , pathIndex : 0 } ]
53- : /* if there's exactly one path, auto-expand
54- * the path when expanding the result */
55- [ resultKey ] ;
56- return ( e : React . MouseEvent ) => toggleExpanded ( e , indices ) ;
57- } , [ result , resultKey , toggleExpanded ] ) ;
49+ const handleDropdownClick = useCallback (
50+ ( e : React . MouseEvent ) => {
51+ const indices =
52+ Keys . getAllPaths ( result ) . length === 1
53+ ? [ resultKey , { ...resultKey , pathIndex : 0 } ]
54+ : /* if there's exactly one path, auto-expand
55+ * the path when expanding the result */
56+ [ resultKey ] ;
57+ toggleExpanded ( e , indices ) ;
58+ } ,
59+ [ result , resultKey , toggleExpanded ] ,
60+ ) ;
5861
5962 const resultRowIsSelected =
6063 selectedItem ?. resultIndex === resultIndex &&
0 commit comments