diff --git a/web/src/pages/Docs.tsx b/web/src/pages/Docs.tsx index 1691bfa8..121e0930 100644 --- a/web/src/pages/Docs.tsx +++ b/web/src/pages/Docs.tsx @@ -116,6 +116,11 @@ export default function Docs(): JSX.Element { window.history.pushState(null, '', url) } + // Keep compatibility with encoded page path + useEffect(() => { + updateUrl(version, hideUi) + }, []) + const iFramePageChanged = (urlPage: string, urlHash: string): void => { if (urlPage === page.current) { return diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index c9928845..a23d3b97 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from 'react' +import { useNavigate } from 'react-router' import { useProjects } from '../data-providers/ProjectDataProvider' import { ErrorOutline } from '@mui/icons-material' @@ -18,6 +19,7 @@ import LoadingPage from './LoadingPage' import styles from './../style/pages/Home.module.css' export default function Home(): JSX.Element { + const navigate = useNavigate() const { loadingFailed } = useProjects() const { filteredProjects: projects, query } = useSearch() const [nonFavoriteProjects, setNonFavoriteProjects] = useState([]) @@ -25,6 +27,11 @@ export default function Home(): JSX.Element { document.title = 'Home | docat' + // Keep compatibility with hash-based URI + if (location.hash.startsWith('#/')) { + navigate(location.hash.replace('#', ''), { replace: true }) + } + const updateFavorites = (): void => { if (projects == null) return