Turbo and UJS removal

I am trying to use turbo with webpacker. I noticed that the installation instructions required to remove ujs. I removed and installed it as it was instructed and I noticed that the default data-confirm attributes in links and link_to with method _destroy are no longer working. Is that the expected behavior or am i doing it wrong?.

Yes it’s expected. You can still use rails UJS, it won’t interfere with Turbo as long as you remove all data-remote attributes on your forms and links.

I guess the behavior with data confirm can be reimplemented pretty easily with a stimulus controller if you want to get rid of the dependency

I’m in a similar position. I use Rails.ajax to do things like sort lists and toggle settings from my stimulus controllers and the installation docs for turbo-rails currently specify rails_ujs should be removed

I’m wondering if there’s a hotwire friendly pattern for this type of task (reframing everything as a form submission?) otherwise it seems I’ll keep rails_ujs around.

We stopped removing UJS, and instead just document the compatibility: https://github.com/hotwired/turbo-rails#compatibility-with-rails-ujs

11 Likes

Thanks David, that’s helpful!

If anyone has followed the suggestion to reimplement the UJS data-confirm behavior with Stimulus, I think sharing that would be a great contribution to the community via Stimulus Connect.

3 Likes