-
-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View Transition API not working for router.history
navigation calls
#2983
Comments
I don't see any animations, can you please check if your is complete? Also: Did this work before? |
@schiller-manuel Loom on the same project: https://www.loom.com/share/5a0b0f59c0644233af5a9d2e8d9c9b67?sid=a320be18-540e-4f2d-9521-e3d0daf877c0 I don't believe it was working before, but I only recently started turning on transitions on our application. The issue is present on v1.87.9. |
where in the example code is this transition defined? |
@schiller-manuel const router = createRouter({
routeTree,
defaultPreload: 'intent',
defaultViewTransition: true,
}); |
the problem here is that
|
@schiller-manuel So it sounds like the window event listener for browser history navigation events is doubling up with the router history Is the solution to simply remove notify() from the |
yes this will break those other history implementations. so notify() must be called there still, but not for browser history I did not try it, but |
Yeah, it's present on |
another solution would be to not let history call would probably be a bit cleaner and gives more control to the history implementations. |
Well, the issue is that subscribers and notify() aren't present until after the history object is created in createHistory, so they can't be included in the implementation of createBrowserHistory and createMemoryHistory. It would be a larger change to the API to make createHistory take a function parameter to build an object. |
browser history already calls |
Oh duh. I'll see if I can open a PR tonight then. I agree that that implementation would look cleaner. Only potential issue is that it would break anyone's custom implementation of |
you are right about that potential break. |
this will be fixed by #3017 here is the example from above with the PR built package: https://stackblitz.com/edit/github-axehctcy-wceasuwu?file=package-lock.json |
Which project does this relate to?
Router
Describe the bug
When navigating through browser history manually using the Tanstack Router
BrowserHistory
API, native browser transitions (from the new View Transitions API) are not happening. They do occur when using the nativewindow.history
API.Example use case would be a "Back" button that navigates the user back in history.
Your Example Website or App
https://stackblitz.com/edit/github-axehctcy
Steps to Reproduce the Bug or Issue
Expected behavior
Navigation should use the same transition that navigating back with the window.history.back() or native browser back button uses. Notice the other button in the example does transition.
Screenshots or Videos
No response
Platform
Additional context
The
notify()
call in the browser history source appears to override or cancel out the default transition animation. Is it possible that we do not need to call browser history subscribers in some history events, since native browser events like the user clicking the back button do not do so either?The text was updated successfully, but these errors were encountered: