Fix history state manipulation
This commit is contained in:
@@ -17,6 +17,9 @@ function CelexSelector() {
|
||||
setArticleId(1);
|
||||
}}
|
||||
>
|
||||
<option value="" disabled>
|
||||
Select an example
|
||||
</option>
|
||||
{examples.map((example) => (
|
||||
<option key={example.id} value={example.id}>
|
||||
{example.name}
|
||||
|
||||
@@ -30,7 +30,7 @@ export const useUrlSync = () => {
|
||||
|
||||
// Update the URL when Zustand changes
|
||||
useEffect(() => {
|
||||
if (celexId === null) {
|
||||
if (!celexId) {
|
||||
return;
|
||||
}
|
||||
let targetUrl = `/${celexId}`;
|
||||
|
||||
@@ -4,7 +4,7 @@ import useNavStore from "../store/navStore";
|
||||
|
||||
function MainView() {
|
||||
useUrlSync();
|
||||
const celexId = useNavStore((state) => state.celexId);
|
||||
const celexId = useNavStore.use.celexId();
|
||||
|
||||
if (!celexId) {
|
||||
return <div>Error: No CELEX ID provided</div>;
|
||||
|
||||
Reference in New Issue
Block a user