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

Unable to Disable Turbo Streams on a Form #1361

Open
justwiebe opened this issue Jan 14, 2025 · 0 comments
Open

Unable to Disable Turbo Streams on a Form #1361

justwiebe opened this issue Jan 14, 2025 · 0 comments

Comments

@justwiebe
Copy link

I have a POST login form that redirects to the page that the user was trying to go to on success. Because it's a redirect, the text/vnd.turbo-stream.html Accept header is copied over to the new GET request. This causes issues on some pages that support turbo streams (the root path in my case) because they'll incorrectly determine that the request is a turbo stream request and the response is nothing that my login form is capable of interpreting.

It would be really useful if https://github.com/hotwired/turbo/blame/ae14a60e7a5784deeb54cadeb47778693855c57f/src/core/drive/form_submission.js#L211 respected a data-turbo-stream="false" for such cases. I tried disabling turbo altogether (data-turbo="false") but then that seems to interfere with Turbo-Native, and the login form does nothing in mobile apps.

Devise login form:

= simple_form_for resource, as: resource_name, url: session_path(resource_name), data: { turbo_action: :replace } do |f|
  .card__body
    h1.login__header Login
    = f.input :username
    = f.input :password
  .card__footer
    .actions
      = render "devise/shared/links"
      button.btn.btn-primary type="submit" Log In
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant