diff --git a/frontend/app/components/Highlights/HighlightsList.tsx b/frontend/app/components/Highlights/HighlightsList.tsx index e0158b3ce..0f6fa9c6b 100644 --- a/frontend/app/components/Highlights/HighlightsList.tsx +++ b/frontend/app/components/Highlights/HighlightsList.tsx @@ -12,8 +12,13 @@ import { toast } from 'react-toastify'; import EditHlModal from './EditHlModal'; import HighlightsListHeader from './HighlightsListHeader'; import withPermissions from 'HOCs/withPermissions'; +import { useHistory } from 'react-router'; +import { highlights, withSiteId } from 'App/routes' function HighlightsList() { + const history = useHistory(); + const params = new URLSearchParams(window.location.search); + const hlId = params.get('highlight'); const { notesStore, projectsStore, userStore } = useStore(); const [activeId, setActiveId] = React.useState(null); const [editModalOpen, setEditModalOpen] = React.useState(false); @@ -23,6 +28,13 @@ function HighlightsList() { }); const currentUserId = userStore.account.id; + React.useEffect(() => { + if (hlId) { + setActiveId(hlId); + history.replace(withSiteId(highlights(), projectsStore.siteId)); + } + }, [hlId]) + const activeProject = projectsStore.activeSiteId; const query = notesStore.query; const limit = notesStore.pageSize;