You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only support this router has, is for starting a document.startViewTransition via the viewTransition prop.
But, this is not enough in my case.
Take this use case for example:
We have an item overview page
We have an item details page
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-name on 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 useViewTransitionState hook, so we can add a class of whatever based this info, as long as it's transitioning (transition done, then null/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.finished promise.
Remix react-router does, 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-router has 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 )
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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