Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Nov 21, 2024
1 parent db89d7c commit 77239cc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
20 changes: 11 additions & 9 deletions web/src/main/javascript/src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default function SearchBar({
);
}

const getPreviousResult = () => {
const getPreviousResult = useCallback(() => {
if (!resultsAndIndexDefined) {
return;
}
Expand All @@ -315,9 +315,9 @@ export default function SearchBar({
}
oncoTree?.focus(cancerTypeResults[newIndex]);
setCancerTypeResultsIndex(newIndex);
}
}, [resultsAndIndexDefined])

const getNextResult = () => {
const getNextResult = useCallback(() => {
if (!resultsAndIndexDefined) {
return;
}
Expand All @@ -331,9 +331,11 @@ export default function SearchBar({
}
oncoTree?.focus(cancerTypeResults[newIndex]);
setCancerTypeResultsIndex(newIndex);
}
}, [resultsAndIndexDefined])

useEffect(() => {
const prevButton = prevButtonRef.current;
const nextButton = nextButtonRef.current
const prevButtonTouchHandler = (event: TouchEvent) => {
getPreviousResult();
event.preventDefault();
Expand All @@ -342,14 +344,14 @@ export default function SearchBar({
getNextResult();
event.preventDefault();
};
prevButtonRef.current?.addEventListener("touchstart", prevButtonTouchHandler);
nextButtonRef.current?.addEventListener("touchstart", nextButtonTouchHandler)
prevButton?.addEventListener("touchstart", prevButtonTouchHandler);
nextButton?.addEventListener("touchstart", nextButtonTouchHandler)

return () => {
prevButtonRef.current?.removeEventListener("touchstart", prevButtonTouchHandler);
nextButtonRef.current?.removeEventListener("touchstart", nextButtonTouchHandler);
prevButton?.removeEventListener("touchstart", prevButtonTouchHandler);
nextButton?.removeEventListener("touchstart", nextButtonTouchHandler);
}
}, []);
}, [getNextResult, getPreviousResult]);

return (
<>
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/assets/favicon-DLSGxvBL.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OncoTree</title>
<script type="module" crossorigin src="/assets/index-D07rChaF.js"></script>
<script type="module" crossorigin src="/assets/index-BpCjHjQC.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B7wOa-XQ.css">
</head>
<body>
Expand Down

0 comments on commit 77239cc

Please sign in to comment.