Questions tagged [hotwire-rails]

Hotwire-rails is a collection of front-end tools for Rails available since Rails 6 and enabled by default in Rails 7. Use the [Hotwire-rails] tag for questions about Stimulus, Turbo Drive, Turbo Frames and Turbo Streams and especially their usage in Rails. This tag is not for turbo-links (unless the question is about updating to Hotwire). Also be aware that Hotwire and its components are sometimes used outside of Rails.

See also:

228 questions
5
votes
1 answer

Inline Devise Signup form using Turbo Frames

I'm having trouble setting up a Devise sign-up form using Turbo Frames. I'd like to have the Devise sign up form set up as a "gradual engagement" form that only requires email to register the new user from the homepage. Here's how I've set this up…
Lee McAlilly
  • 9,084
  • 12
  • 60
  • 94
5
votes
2 answers

Rails Turbo doesn't trigger turbo:load event

The turbo:load event is not fired after a turbo visit (as the documentation says it should). It works as expected after the initial full-page load. I can catch the "turbo:before-fetch-response" event, but I have no luck with turbo:load, :render,…
BEEK
  • 151
  • 2
  • 5
5
votes
1 answer

Best practice: Ok to render Turbo Stream response only? Or always include standard HTML response?

Is it best practice to keep both format.html and format.turbo_stream responses in the respond_to block for ALL controller responses? Is there any scenario where it is safe to only include a turbo_stream response? The Hotwire documentation…
richleenyc
  • 89
  • 5
5
votes
2 answers

Hotwire Rails - Cannot use import statement outside a module

I have installed hotwire-rails in an existing Rails project. Before even writing any hotwire related code I get the following error on the browser console on every page: Uncaught SyntaxError: Cannot use import statement outside a module in…
5
votes
3 answers

Turbo_stream format not being sent anymore

we are currently working on changing our web app search engine from Stimulus to Turbo. However, we keep getting an HTML request instead of a Turbo one from our script with the error : “ ActionController::UnknownFormat “. Trying to force the request…
Bolo
  • 2,668
  • 4
  • 27
  • 34
4
votes
1 answer

In rails, Turbo just appends the response from the server at the end of current page

The problem: Turbo just appends the response from server to the end of current page. Not replacing the page like expected. Recently upgraded from Rails 6 to 7. Also I switched from importmap to esbuild. I have a form that is making a post to a…
JUlinder
  • 995
  • 1
  • 8
  • 19
4
votes
2 answers

Typing indicator with action cable in rails- 7

I am unable to add typing indicator in my rails app with action cable I have created app in rails 7 and I user trubo stream tag and broadcast in it so I did't used channel for live chat , I tried to find tutorial and video but there is not any I…
4
votes
1 answer

How to delete and redirect out of a turbo frame

I need to delete a record using standard routing and redirect to a separate page. The link needs to be within a turbo frame and have a confirmation message. I'm using rails 7 and would expect the following to work; # _form.html.slim <%=…
JesseWelch92
  • 109
  • 10
4
votes
0 answers

turbo_stream_from suddenly stopped working

I'm running a rails 6 app that is heavily using all sorts of hotwire goodness. I noticed that after a deploy my turbo streams stopped working. In my view I've got <%= turbo_stream_from "#{dom_id(@class)}_lesson" %> Which in theory should start…
ilrock
  • 573
  • 8
  • 24
4
votes
1 answer

Turbo Drive not intercepting link clicks (but turbo:load event fires)

I'm experimenting with adding Turbo to a Rails 6.1 app. It seems to be loading (see "What I've tried"), but when clicking around the clicks does not seem to be intercepted. I'm still getting full page reloads. Can anyone help me spot what is missing…
4
votes
1 answer

Rails 7: Loading all Stimulus controllers

I've recently upgraded my app from Rails 6 to Rails 7, but some items seem to have changed with how Stimulus controllers are loaded from javascript/controllers. I Rails 6 I was able to do this from an index.js file in the javascript/controllers…
JP Silvashy
  • 46,977
  • 48
  • 149
  • 227
4
votes
1 answer

Rails: Turbo Stream Broadcast not updating view

I have a Turbo Stream which is not updating the view and I'm not sure why. I have two other broadcasts setup in a similar configuration which are working fine. Everything looks like it should be working from what I can see, I'm just not getting the…
Phil-6
  • 552
  • 6
  • 16
4
votes
1 answer

Maintain input focus on Turbo Load?

I have content and a search form wrapped in a turbo frame. As the user types in the search field the content updates live. The issue is the search field loses focus each time. Any way to maintain focus? It also should be only while typing and not…
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
4
votes
1 answer

Use Stimulus Controller in multiple places

I want to be able to use a Stimulus Controller in multiple places in a web app. I want do something like this:
Rafael Mora
  • 1,095
  • 2
  • 13
  • 21
4
votes
3 answers

Error in Form Submisson with Rails and Hotwire

I am running rails 6.1 with hotwire. I am creating a login form take email and password and then redirect to the store_index path. However, I am running into this error- Error: Form responses must redirect to another location. I have tried the…
Osborne Saka
  • 469
  • 1
  • 4
  • 21
1
2
3
15 16