-
Notifications
You must be signed in to change notification settings - Fork 329
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
Turbo Frame Responses missing tracked elements #580
Comments
Is this also related to hotwired/turbo#1047? The reproduction in #581 demonstrates that hotwired/turbo#1144 might not've resolved the underlying issue. |
Yes, I believe that's related. I've found a workaround for the issue – replacing
This change might be acceptable as a short term patch to get frame navigations working with
After I made this change, I was running through one of our larger apps updating syntax and I came across a bug that I then spent a good half an hour debugging, only to realise it was this same bug – another layout rendering which doesn't track the application stylesheet – and it was so unclear that this was happening that even though I was literally testing for this change I didn't realise that I was seeing another symptom of this same issue. If the Turbo team is going to stick with the strategy of sending a full |
For future me/anyone else debugging this issue, this is what happens when a turbo-frame advance occurs:
This is where things start to go wrong:
The browser history is now inconsistent with the restoration cache. The snapshot for the previous page state never gets saved, but the page doesn't get reloaded because |
This same bug bit me again, I keep assuming my code is wrong instead of checking that the heads match. You can tell whether this bug has occurred by checking:
If it's true after a frame navigation, your history is now invalid. |
I spent this morning troubleshooting back button problems in my app, which was recently upgraded to turbo 8.0 / turbo-rails 2.05. I believe the issue outlined here is the culprit. The workaround shared by @sfnelson addresses the problem for me so I will be using that for now. FWIW, my app isn't doing anything fancy with Turbo, just decorating links with |
I just upgraded an app to Rails 7.1 and ran into this. Been banging my head against this bug for the last few hours. Glad I tracked down this post 😅 The workaround above worked for me as well (thanks @sfnelson). It doesn't seem ideal, so going to try downgrade turbo-rails for now. |
When rendering a turbo-frame with
data-turbo-action="advance"
to promote visits, Turbo checks the head of the current document against the head of the incoming response to decide whether to 'render' the synthetic navigation.In the turbo tests, this check passes because the head of the frame response matches the page response, but in a frame response generated by turbo-rails, the head is empty and so the check fails.
This behaviour changed in Turbo 8/Turbo Rails 2, and as a consequence frame navigation visits are no longer compatible with history restorations.
The text was updated successfully, but these errors were encountered: