Skip to content
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

[BUG] Transition hangs after 400~500 page visit #14

Open
YummYume opened this issue Aug 14, 2023 · 6 comments
Open

[BUG] Transition hangs after 400~500 page visit #14

YummYume opened this issue Aug 14, 2023 · 6 comments

Comments

@YummYume
Copy link
Contributor

Hello! It's me again.

I updated to the latest version and really decided to try out the view transition API. It works very well and looks very smooth.

However, I encountered a weird behaviour. After visiting a 400~500 status code page (like a 404 page), future navigation will hang for a long time (a few seconds) during which I cannot do anything on the page. It's definitely not a speed problem, as the networks tab completes instantly. Removing Turn also gets rid of the problem. I created a new quick Symfony app and tried it without any other package and with default transitions, and the problem persists. I also tried to set Turn.config.experimental.viewTransitions = false; but it doesn't seem to do anything? It's still using the view transition API, I believe (dunno if this is intended).

Looking in the DevTools, it seems that the transition API tries to animate something? Because I can see the ::view-transition appear while it hangs. It's also worth noting that it does not happen when I visit the 404 page directly from my browser and then click on the homepage. It only happens when Turbo visits the 404 link.

If needed, I can create a quick repository to highlight what I did exactly and what the problem is (I only tested it in Symfony apps, but I doubt it's a problem with it, I just built the assets normally using Webpack).

@YummYume
Copy link
Contributor Author

Here's a quick video I made to showcase the problem. You can see that right after I visit the 404 page, all visits hang for a few seconds.

turn-bug.mp4

@domchristie
Copy link
Owner

Thanks for this. I'll look into it.

@domchristie
Copy link
Owner

It looks like turbo:load is not fired when the response errors. I'll see if there's a workaround, but I've raised an issue here: hotwired/turbo#958

@YummYume
Copy link
Contributor Author

Thanks for such a quick response (and PR to fix the problem) ! In the meantime, is there any (even dirty) workaround to it? I was thinking about just disabling Turn during error pages, but I'm not too sure on what's the best way to do it.

@domchristie
Copy link
Owner

Unfortunately there currently isn't a workaround. You may wish to use Turn v2.1, as this does not have View Transitions enabled by default.

Aside: In my own 404 tests, I'm not seeing any hanging. However I have noticed that the turn-enter and turn-advance classes are not being removed, so there's definitely something wrong.

@YummYume
Copy link
Contributor Author

YummYume commented Sep 2, 2023

Well, I ended up just deactivating drive navigation on those pages using the meta tag, causing a full page reload after navigating out. The only case where it will not work is when you hit the back button and Turbo performs a restoration. I suppose it could even be better to completely disable Turbo temporarily on those pages.

But I see that hotwired/turbo#960 has been merged, so I'm hoping for a release sooner or later 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants