-
Notifications
You must be signed in to change notification settings - Fork 436
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
Don't include Turbo-Frame header in promoted frame navigations #1143
Conversation
This commit changes the behavior of frame navigations promoted with the `[data-turbo-action]` attribute so that they don't include the `Turbo-Frame` header in their requests. This mimics the existing behavior of frame navigations promoted with `[data-turbo-target=_top]`. If we don't do this turbo-rails will see the `Turbo-Frame` header and render the response as a frame update, with a minimal layout that doesn't include any assets. When Turbo receives the response it believes it's a full page response in which the assets have gone stale and it issues a full page reload with `tracked_element_mismatch` as the reason. Fixes #1047 This is similar to #1138
I think this still triggers a
I was under the impression that a frame visit with an action should only replace a part of the page and update the history (not target the whole page). Am I misunderstanding? |
Oh, you're right. Not sure if that's a big issue, as far as I know we only use the |
Possibly I'm misunderstanding, but I think the current behaviour was correct. As @domchristie says, these are frame visits that are configured to also update the history. So it's correct that these requests send the The bug you describe in the description sounds more like an error in treating a frame response as if it was a full page response. Turbo should know that the frame request is not responsible for populating the assets in In which case, removing the Do I have that right? |
If I'm understanding the behaviour correctly, Turbo processes the frame response as expected, but then performs another visit with turbo/src/core/frames/frame_controller.js Line 373 in b7187f1
tracked_element_mismatch
Am I correct in thinking that frame requests can populate content in |
@domchristie yes, exactly. It's when performing the visit that Turbo incorrectly treats the frame response as a full page response with regard to the asset version checking. It's a step that shouldn't happen for frame responses, even those with actions. Avoiding that would solve this bug.
Frame requests shouldn't be able to render anything outside of their target frame, as I understand it. The responses can return content in |
I found a better fix in #1144 |
This PR changes the behavior of frame navigations promoted with the
[data-turbo-action]
attribute so that they don't include theTurbo-Frame
header in their requests. This mimics the existing behavior of frame navigations promoted with[data-turbo-target=_top]
.If we don't do this turbo-rails will see the
Turbo-Frame
header and render the response as a frame update, with a minimal layout that doesn't include any assets. When Turbo receives the response it believes it's a full page response in which the assets have gone stale and it issues a full page reload withtracked_element_mismatch
as the reason.Fixes #1047
This is similar to #1138
//cc @seanpdoyle @domchristie