Replies: 1 comment 2 replies
-
|
@tannerlinsley , if I make a MR, would you take a look at it? I have it working, implemented as other hooks etc are, but I'm a bit confused about I only did the react-router implementation, but at it's core, it's coming from the
The hook is nicely working for "old" and "new" transitions (following the naming convention of the ViewTransitions css pseudo classes) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Currently, the only support this router has, is for starting a
document.startViewTransitionvia theviewTransitionprop.But, this is not enough in my case.
Take this use case for example:
We want to do view transitions for the image for example.
In the overview, when clicking an item, it needs to know which item image to give a
view-transition-name.On the details page, when clicking the link for the overview, in the overview, we need to see from which item details page we come, to set again the
view-transition-nameon that particular item, and remove it again when the viewTransition is done.I need to know where user comes FROM, or goes TO, before a viewTransition is starting, all packed in the return of a
useViewTransitionStatehook, so we can add a class of whatever based this info, as long as it's transitioning (transition done, thennull/undefined). Also the params are important, so if they won't end up in the possible returned object, it would we good if can we have a function to get the params from a path, like react-router matchPath?Currently, the code cannot support it at all, because diving in the source code, the core router only does this:

It doesn't put the returned ViewTransition instance in a constant, to be able to act on the
viewTransition.finishedpromise.Remix
react-routerdoes, but it doesn't support the{types: string[]} that I also need, and looking into their source code, I cried a little and searched for alternatives, and ended up here. I wanted to see if I can do a contribution, but it's imho pretty messy there. (I don't want to make people feel bad)react-routerhas the useViewTransitionState, that is useful here, although I don't know if that works for both ways (I tried now with the Tanstack router, that I forgot my old code :), but I had it all working, except no vt-types )Beta Was this translation helpful? Give feedback.
All reactions