Skip to content

Commit

Permalink
merge: Avoid endlessly recalculating the breadcrumbs (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Jan 27, 2025
2 parents 6297594 + ea2fcc7 commit 8617e19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Breadcrumbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { API_BASE_URL } from '../APIConfig';
export const Breadcrumbs = () => {
const location = useLocation();
const [breadcrumbLabels, setBreadcrumbLabels] = useState({});
const pathnames = location.pathname.split('/').filter((x) => x);

const fetchModelInfo = async () => {
const response = await fetch(API_BASE_URL + `/model-info`);
Expand Down Expand Up @@ -37,6 +36,7 @@ export const Breadcrumbs = () => {
const updateLabels = async () => {
const title = await fetchModelInfo();
const labels = { '/': title };
const pathnames = location.pathname.split('/').filter((x) => x);

for (let i = 0; i < pathnames.length; i++) {
const to = `/${pathnames.slice(0, i + 1).join('/')}`;
Expand All @@ -56,7 +56,7 @@ export const Breadcrumbs = () => {
document.title = `${instanceName} - ${modelName} - Model Explorer`;
};
updateLabels();
}, [location, pathnames]);
}, [location]);

const visible_pathnames = [
breadcrumbLabels['/'],
Expand Down

0 comments on commit 8617e19

Please sign in to comment.