-
Notifications
You must be signed in to change notification settings - Fork 92
Controlled Interceptor inserting its interceptorFunction into the address bar on navigate #47
Comments
Do you happen to have a codesandbox or something to demonstrate the behavior? Otherwise I would need to recreate the bug, first to find the cause. |
Nevermind, I was able to recreate it. I will investigate. |
Fixed with the released version |
I hadn't had a chance to look at this again until just now, but thanks for the quick fix! I pulled down 1.1.7 and confirmed that it is fixed. This functionality makes animated transitions between pages almost effortless! This is the full code (besides the CSS) to animate in and out.
This is a huge win for this library, and the good work here is much appreciated! Feel free to lift that code and add to the docs, or if there's a spot you'd like to see them I can put in a PR as well. |
Thats a very creative use of the controlled interceptor :D |
That's a great idea! I've done that, just passed in my classes hash and kept the names the same. Makes the PageRoot component much simpler and I can reuse the logic in other places and test in isolation. One note for anyone who wants to try this - the one issue I ran into is on pages that have parameters and can be loaded twice consecutively, it transitions away, but then the transition back in doesn't happen because the transition in effect only runs on mount. My fix was to add a key of Thanks again for your help @Paratron. I did notice one thing that might wind up being a bug for someone later - 🥂 |
I'm trying to apply
useControlledInterceptor
to manage an unmount navigation on a generic component.Outside of this component I have
<A href="/">...</A>
, and when I click this link (or perform any other behavior in the app that causes navigation) I get this url in my address barhttp://localhost:3000/function%20(nextPath,%20currentPath)%20%7B%20%20%20%20%20%20setInterceptedPath(nextPath);%20%20%20%20%20%20return%20currentPath;%20%20%20%20%7D
and my 404 page displays.I assume that this is because the interceptors don't link in with the router context so it only works with navigation caused from within the same component, but I haven't dug into it too far yet.
The text was updated successfully, but these errors were encountered: