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

Don't convert data-turbo-stream links to forms #647

Merged
merged 1 commit into from
Aug 1, 2022
Merged

Don't convert data-turbo-stream links to forms #647

merged 1 commit into from
Aug 1, 2022

Commits on Aug 1, 2022

  1. Don't convert data-turbo-stream links to forms

    The initial implementation of the `data-turbo-stream` attribute worked
    by treating requests with that attribute as form submissions (which
    would usually be `GET` form submissions, unless a different method type
    was indicated).
    
    This allowed us to include the `data-turbo-stream` logic in
    `FormSubmission`, which was responsible for properly setting the
    `Accept` header.
    
    However, there are some downsides to submitting the requests as form
    submissions. For example, a `GET` form submission does not include the
    search portion of the URL. Additionally, servers are free to respond to
    `data-turbo-stream` requests with plain HTML responses, and in that case
    we don't want Turbo's handling of the response to differ from what it
    would have been if the `data-turbo-stream` attribute wasn't present.
    
    This commit takes a different approach. In this version, elements that
    have `data-turbo-stream` continue to be processed by the same object
    that they would otherwise, whether that's a `FormSubmission`, a `Visit`
    or a `FrameController`. However each of these objects is now aware of
    the `data-turbo-stream` attribute, and each will include the Turbo
    Stream MIME type when appropriate.
    
    This minimizes the impact of `data-turbo-stream` so that the only effect
    it has is on the inclusion of that MIME type.
    kevinmcconnell committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    3770b3f View commit details
    Browse the repository at this point in the history