Skip to content

Commit 160642e

Browse files
Convert toggle to use useCallback
1 parent 240dd51 commit 160642e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function AlertTable(props: AlertTableProps) {
4545
* first item, open all the rest as well. This mimics vscode's file
4646
* explorer tree view behavior.
4747
*/
48-
const toggle = (e: React.MouseEvent, keys: Keys.ResultKey[]) => {
48+
const toggle = useCallback((e: React.MouseEvent, keys: Keys.ResultKey[]) => {
4949
const keyStrings = keys.map(Keys.keyToString);
5050
setExpanded((previousExpanded) => {
5151
const expanded = new Set(previousExpanded);
@@ -63,7 +63,7 @@ export function AlertTable(props: AlertTableProps) {
6363
});
6464
e.stopPropagation();
6565
e.preventDefault();
66-
};
66+
}, []);
6767

6868
const getNewSelection = (
6969
key: Keys.ResultKey | undefined,

0 commit comments

Comments
 (0)