Closed Brendan-csel closed 8 months ago
This is definitely a feature that I feel is missing from the router. The contentious part you are talking about is backing out of the app right? Especially after browser refresh as you won't have the history anywhere else? I've used something like depth in the past to solve this so it seems reasonable to me.
What's the concern?
What's the concern?
Really just that this pollutes window.history.state
with a _depth
property to enable this feature.
This PR extends
useBeforeLeave
blocking to include router initiated navigations such as back/forward.See issue https://github.com/solidjs/solid-router/issues/277
We've been using this approach in production for over year now - albeit with the
0.8
router generation and hash integration. Today I rebased this onto0.10.1
and did some basic testing.One aspect that might be contentious is using
_depth
on history state to detect navigation type.Even if not merged, hopefully this PR offers some guidance for others needing this feature.