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

Support for globally opting-out of behaviors? #77

Closed
swanson opened this issue Jan 5, 2021 · 5 comments
Closed

Support for globally opting-out of behaviors? #77

swanson opened this issue Jan 5, 2021 · 5 comments

Comments

@swanson
Copy link

swanson commented Jan 5, 2021

👋

Wondering if there would be an appetite for adding a configuration/setting to opt-out of some of the Turbo modules.

If you only wanted the TurboDrive for links, it might be nice to support a global opt-out of the formSubmitObserver. If you aren't using Frames or Streams, you could opt-out of the streamObserver, frameRedirector, etc.

There are sometimes ways to opt-out of these behaviors on a per-page, per-form, or per-link basis, but I think it would smooth adoption / upgrading from Turbolinks if you could opt-in piecemeal.

I don't think it's a slam dunk, especially since the installation path is really nice and there is no config/settings (outside of the progress timeout). Happy to help implement if there is interest, but wanted to gauge support.

@dhh
Copy link
Member

dhh commented Jan 6, 2021

I think we should wait for some real world cases that demand this before preemptively adding such configurations. I mean, I can imagine this maybe useful to some, but I'd like to see a real case before we add the additional weight.

@swanson
Copy link
Author

swanson commented Jan 6, 2021

I think we should wait for some real world cases that demand this before preemptively adding such configurations. I mean, I can imagine this maybe useful to some, but I'd like to see a real case before we add the additional weight.

Yeah, my only real world case is that I have a large app with lots of forms -- some are form_with, some are form_for, some are remote, some are local -- and I would like to upgrade TurboLinks to TurboDrive but...it's a big undertaking to audit every form (there are hundreds). So I have to undertake that effort before I could start using Turboframes, Streams, etc

@dhh
Copy link
Member

dhh commented Jan 7, 2021

Yeah, that sounds fair. I'd be fine seeing a toggle for each element.

@santib
Copy link

santib commented Jan 8, 2021

I was thinking exactly the same. In my case I'd like to be able to:

  • Turn on/off Turbo Drive (default: on). Why? Because I'd be able to start using Turbo Frames and Turbo Streams right away, even before making sure that none of my forms break with Turbo Drive.
  • Turn on/off Turbo Streams via Websockets (default: on). Why? Because I'd be able to use almost all of Turbo without needing to care about Redis and Websockets. (Maybe this toggle should be on turbo-rails ?)

I don't know if this would be feasible with the current implementation (didn't check yet). But at least from a developer's point of view would be clear IMO.

@swanson
Copy link
Author

swanson commented Jan 9, 2021

This has been resolved in https://github.com/hotwired/turbo/releases/tag/v7.0.0-beta.2 -- opt-out of the form behavior with data-turbo=false on a root element and override on a per form / page basis.

If you want to only opt-out of forms, you can put data-turbo=false in your form builder.

@swanson swanson closed this as completed Jan 9, 2021
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

3 participants