ui: fix hlid opener

This commit is contained in:
nick-delirium 2025-02-21 10:58:41 +01:00
parent 06113f7534
commit f6015f31f5
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0

View file

@ -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<string | null>(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;