Skip to content

Commit

Permalink
merge: Update page title based on current view
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Sep 25, 2024
2 parents 8b00ea9 + e44cda3 commit b532f28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/Breadcrumbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export const Breadcrumbs = () => {
}

setBreadcrumbLabels(labels);
const modelName = Object.values(labels)[0];
const instanceName = Object.values(labels).pop();
document.title = `${instanceName} - ${modelName} - Model Explorer`;
};

updateLabels();
}, [location]);
}, [location, document.title]);

const visible_pathnames = [
breadcrumbLabels['/'],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/HomeView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const HomeView = () => {
const response = await fetch(API_BASE_URL + '/model-info');
const data = await response.json();
setModelInfo(data);
document.title = `${data.title} - Model Explorer`;
} catch (err) {
setError('Failed to fetch model info: ' + err.message);
}
Expand Down

0 comments on commit b532f28

Please sign in to comment.