Skip to content

Commit

Permalink
prevent unnecessary rerenders
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Dec 17, 2024
1 parent adbb83f commit 31a789a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions web/src/main/javascript/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import About from "./pages/About/About";
function App() {
const location = useLocation();
const [searchParams, setSearchParams] = useSearchParams();
const version = searchParams.get("version");

const [oncoTreeData, setOncoTreeData] = useState<OncoTreeNode>();
const [oncoTree, setOncoTree] = useState<OncoTree>();
Expand All @@ -33,13 +34,12 @@ function App() {
}

useEffect(() => {
const version = searchParams.get('version');
try {
version ? fetchData(version) : fetchData(DEFAULT_VERSION);
} catch {
toast.error("Error fetching OncoTree data");
}
}, [searchParams]);
}, [version]);

useEffect(() => {
if (location.pathname !== PageRoutes.HOME) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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-CLRaiHsg.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OncoTree</title>
<script type="module" crossorigin src="/assets/index-AYjgkqMV.js"></script>
<script type="module" crossorigin src="/assets/index-DTFjQa8K.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B7wOa-XQ.css">
</head>
<body>
Expand Down

0 comments on commit 31a789a

Please sign in to comment.