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
1
vote
1 answer

(Rails) Turbostream doesn't update svg in view partial after Stimulus request

I want to click an SVG icon, trigger a Stimulus action which updates my model's (trx) "cleared" attribute on the backend, and then update the view to show a different SVG icon indicating the trx is cleared, without a page refresh. Initially, my view…
chug
  • 71
  • 6
1
vote
0 answers

How to scroll to anchor after navigation with Hotwire Turbo Frame?

I would like to have a link inside a turbo frame that works as usual (i.e. by default, when the link is clicked then the frame targets itself to load content provided at the given link url) but with the addition to scroll the page at a given…
Backo
  • 18,291
  • 27
  • 103
  • 170
1
vote
1 answer

How to know when Turbo.renderStreamMessage completes?

I'm populating an empty list object
    via a turbostream request # myaction.turbo_stream.erb <%= turbo_stream.append "results" do %>
  • HELLO WORLD
  • <% end %> I am making the request via…
    Andy Harvey
    • 12,333
    • 17
    • 93
    • 185
    1
    vote
    1 answer

    Why is Turbo Stream not updating the DOM?

    I am making my first steps to understand Turbo Frames and Turbo Streams. Following a request, my logs indicate that the relevant turbo_stream.erb file has been rendered, but the DOM remains unchanged. Can anyone point me in the right direction and…
    Andy Harvey
    • 12,333
    • 17
    • 93
    • 185
    1
    vote
    1 answer

    Rails 7, Hotwire dynamic forms, updating value doesn't work

    I've recently started using Hotwire for a project I'm working on. Have been following this tutorial on GoRails. Currently having some issues with adding / updating records in a dynamic form. I have two models with a belongs_to and has_many…
    Anders
    • 2,903
    • 7
    • 58
    • 114
    1
    vote
    0 answers

    Turbo Frame Error "Content Missing" before Authentication

    I rebuilt this Cookie Consent Tutorial with Turbo Frame and it has some weird behaviour to it that I can't understand. On the home & sign in page (therefore pages, where the user is not logged in) "Content Missing" is rendered even though I can see…
    1
    vote
    2 answers

    Nested Stimulus HTML preventing passing values

    With the following I can't access the values in the controller
    Greg
    • 2,359
    • 5
    • 22
    • 35
    1
    vote
    1 answer

    Rails 7 Turbo stream / turbo frame. Render index with new item

    I am having terrible problems trying to get a new item to render back to the index of a page using turbo streams. I want it to go back to the index after the create action and append the deal to the page, I need this to be a turbo stream. So far…
    1
    vote
    1 answer

    Using turbostreams in wicked wizard's "show" action?

    I'm confused about the pattern someone would use to replace an item in the dom using turbo streams in combination with wicked wizard using the "show action". In my scenario, I'm trying to replace a nested turboframe "foo" that exists on step_b using…
    APysnack
    • 73
    • 6
    1
    vote
    1 answer

    Network response with nested turboframe linking to same page doing a full html request?

    I have a nested turbo frame My controller is something like def landing_page @variable = params[:variable].present? ? params[:variable] : "hello" end The view for my landing page is: <%= turbo_frame_tag "outer" do %>
    <%= @variable…
    1
    vote
    1 answer

    turbo_frame_tag request with other formats than HTML

    Given the following <%= turbo_frame_tag dom_id(@item, "loader_helper"), src: home_index_path(@item) %> This code will trigger with page load other request to specified controller Started GET "/home/1" for ::1 at 2023-01-23 16:10:39 +0300 Processing…
    zhisme
    • 2,368
    • 2
    • 19
    • 28
    1
    vote
    0 answers

    HTML not updating when rendering tubostream in Rails 7 for a custom controller method

    I am running Rails 7.0.4 and attempting to use turboframe/tubostream with a customer controller. I am trying to add an error message to the screen when the field from the form is not updated. The custom controller update method is triggered by a…
    1
    vote
    1 answer

    How to show percent done of a file upload with turbo_stream and no custom js?

    I have a form with: <%= form_with(model: doc, url: my_docs_path(@application, doc), id: "#{dom_id(doc)}_form", html: {multipart: true}) do |form| %> <%= form.file_field :doc %> <%= form.submit 'Upload Doc' %> <% end %> which hits my…
    Andrew Arrow
    • 4,248
    • 9
    • 53
    • 80
    1
    vote
    0 answers

    What is the action for a rollover in Rails Stimulus

    I have a map (geographic) with lines drawn from one location to another. When rollover that line the information about the end points should be displayed. I've got the map and line drawing in a connect action in a Rails Stimulus controller and want…
    Greg
    • 2,359
    • 5
    • 22
    • 35
    1
    vote
    1 answer

    Rails 7 + Hotwire/Turbo: Is it possible to specify the location of a turbo_stream.erb template?

    Scenario Take for example the following code: class AwesomeController < ApplicationController ... def update respond_to do |format| format.html format.turbo_stream end end ... end As I understand it, the…
    John
    • 9,254
    • 12
    • 54
    • 75