-
I'm using the hashrouter and when clicking on The following const navigate = useNavigate();
navigate(-1); works as well. So yeah my question is why is this behaviour not preserved when clicking on solidjs' special anchor tag This is how I'm detecting changes for window.history.state._depth: const navigate = useNavigate();
const location = useLocation();
const histDepth = createMemo(() => {
// Subscribe to url changes such that any route change based
// on navigate() or <A/> etc. will cause this memo to run
// This should also handle replace=True for <A/> by ignoring
// subscribers to this memo in that case.
location.hash;
location.state;
location.query;
location.search
location.key;
location.pathname;
console.log(window.history.length);
console.log(window.history.state._depth);
return window.history.state._depth;
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Okay I solved it by listening for const navigate = useNavigate();
const isRouting = useIsRouting();
const histDepth = createMemo(() => {
// Subscribe to any route change. This should be able to handle the case
// where <A ... replace=True>...</A> by ignoring subscribers to this memo
// because window.history.state._depth will be the same as before.
isRouting();
return window.history.state._depth;
}); |
Beta Was this translation helpful? Give feedback.
Okay I solved it by listening for
window.history.state._depth
this way 😎: