Fix history state manipulation

This commit is contained in:
Adrian Rumpold
2025-04-30 12:15:44 +02:00
parent 7dd913df7b
commit 2886989835
3 changed files with 5 additions and 2 deletions

View File

@@ -17,6 +17,9 @@ function CelexSelector() {
setArticleId(1); setArticleId(1);
}} }}
> >
<option value="" disabled>
Select an example
</option>
{examples.map((example) => ( {examples.map((example) => (
<option key={example.id} value={example.id}> <option key={example.id} value={example.id}>
{example.name} {example.name}

View File

@@ -30,7 +30,7 @@ export const useUrlSync = () => {
// Update the URL when Zustand changes // Update the URL when Zustand changes
useEffect(() => { useEffect(() => {
if (celexId === null) { if (!celexId) {
return; return;
} }
let targetUrl = `/${celexId}`; let targetUrl = `/${celexId}`;

View File

@@ -4,7 +4,7 @@ import useNavStore from "../store/navStore";
function MainView() { function MainView() {
useUrlSync(); useUrlSync();
const celexId = useNavStore((state) => state.celexId); const celexId = useNavStore.use.celexId();
if (!celexId) { if (!celexId) {
return <div>Error: No CELEX ID provided</div>; return <div>Error: No CELEX ID provided</div>;