Fix history state manipulation
This commit is contained in:
@@ -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}
|
||||||
|
|||||||
@@ -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}`;
|
||||||
|
|||||||
@@ -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>;
|
||||||
|
|||||||
Reference in New Issue
Block a user