-
Notifications
You must be signed in to change notification settings - Fork 432
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
FIX: Turbo stream link setting the src of a turbo frame container #968
Conversation
98e61ec
to
598c631
Compare
I have rebased this PR after the Typescript changes and would love some feedback. This bug has been a pain in our production app for some time now. |
ac9d24a
to
179b603
Compare
Might need a rerun on this. My tests are green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test failures are legit, I can reproduce them locally too.
See my comment about the conditional in willFollowLinkToLocation
for a possible solution.
179b603
to
ff8deaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, all good. Thanks @BakiVernes @shiftyp 🙏
Bug Overview
This PR addresses a specific issue that arises when using a Turbo Stream link within a Turbo Frame in a Rails 7 application. Clicking on such a link currently sets the
src
attribute of the Turbo Frame element. Although Turbo saves this state for browser history navigation, it fails to fetch the content correctly. This is because thesrc
attribute is intended to be used for Turbo Stream responses, leading to unexpected behavior.Steps to Reproduce
src
attribute of the Turbo Frame element is set.Visual Reference
Proposed Solution
This PR adds a conditional check for the
data-turbo-stream
attribute. If the attribute exists, thesrc
attribute of the Turbo Frame element will not be modified, thus preserving the expected behavior.By implementing this check, the PR aims to make the behavior of Turbo Stream links within Turbo Frames more predictable and consistent with user expectations.