Questions tagged [hotwire]

45 questions
9
votes
5 answers

How can I disable Hotwire / Turbo (the Turbolinks replacement) for all forms in a Rails application?

In Rails 7, Turbolinks is replaced by Hotwire / Turbo. This patches up web links so that they become AJAX-style requests just like Turbolinks did, but also patches up forms. On the whole, we found this broke swathes of our application. Forms that…
Andrew Hodgkinson
  • 4,379
  • 3
  • 33
  • 43
6
votes
0 answers

Stimulus does not identify outlets in Rails 7 app

In a Rails 7 app, clicking an icon toggles the display property of a form. Both HTML elements connect properly to their respective controllers (toggler and togglee). The form (togglee) is an outlet of the icon (toggler). The problem: The toggler…
BEEK
  • 151
  • 2
  • 5
5
votes
0 answers

Remember Me in Devise fails to Login User

If I don't use remember_me option, it works perfectly fine. The app flows as expected. However, if I check remember_me, it will login in as expected, redirect me to a protected page, which will then redirect me back to the sign_in page (Since I use…
Sawaid
  • 77
  • 1
  • 2
  • 11
5
votes
1 answer

Why is my Flash.now not outputting after a render?

I have a minor issue I can't seem to figure out. Regular flash works just as intended. flash[:test] = 'Blarrgh' redirect_to etcs_url Will display 'Blarrgh' since I have this code in my application.html.erb <% if flash[:test] %> <%=…
TedTran2019
  • 887
  • 5
  • 15
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
4
votes
1 answer

Turbo frame not loading html when using src attribute

I am trying to load html into a turbo frame using the src attribute, but when I load the page the frame exists on I don't see a network request being issued to get the html. This is the markup I have written on the rendered page: <%= turbo_frame_tag…
Jbur43
  • 1,284
  • 17
  • 38
3
votes
1 answer

Turbo Stream link_to strips out custom attributes in GET request

I'm using Rails 7. I wanted to create a link using link_to that inserts some custom form fields for a many-to-many relation into a form via a hotwired frame elsewhere on the page. In order to customize the form fields generated (setting defaults…
3
votes
1 answer

Hotwire/Turbo Frames: why `target: "_top"` isn't requesting pages via fetch?

I'm in the early stages of migrating a Rails app from Turbolinks/rails-ujs (using good ol js.erb views that worked wonders) to Hotwire/Turbo. Picture a traditional users/index.html.erb page with a search form and results table: <%= form_with(scope:…
sandre89
  • 5,218
  • 2
  • 43
  • 64
3
votes
2 answers

Can't resolve '@hotwired/stimulus-loading' Heroku deployment on Rails 7

Help.. As I was deploying to Heroku on my rails app I get this error on the terminal. By the way , I'm using Rails 7.0.1 on Ruby 3.0.3 Compilation failed: remote: [webpack-cli] ModuleNotFoundError: Module not found: Error: Can't resolve…
learningDev
  • 41
  • 1
  • 6
2
votes
1 answer

Reload turboframe with Hotwire (Stimulus/Turbo/Rails)

I'm working with Hotwire the last month or two and trying to understand how to reload a specific turbo-frame after it renders the first time. Let's say I have a simple rails controller for user searches. If it has a param of name, return users…
D1D2D3D4D5
  • 101
  • 6
2
votes
1 answer

Rails 7 - Stimulus controller do not see html target

import { Controller } from "@hotwired/stimulus"; import consumer from "channels/consumer"; export default class extends Controller { static targets = ["users", "roomId"] connect() { this.subscription =…
Wordica
  • 2,427
  • 3
  • 31
  • 51
2
votes
1 answer

Rails 7 portfolio webpage seemingly wont load application.js unless reloaded

I took my first step into creating a website with my own two hands to much of my peril (being so new). That being said, I know I'm sloppy so please correct EVERY SINGLE DETAIL you can so I can learn :) Initially, developing with Rails 7 + bootstrap…
2
votes
0 answers

Using turbostreams in Rails to re-render a partial using a collection that depends on a date range set within the controller

I'm trying to add live update functionality to a statistics page using Turbo. The page has a user-set date range with a simple filter using url params. The value of each stat is determined by summing values of a collection of objects (matched by the…
daveanderson88
  • 327
  • 1
  • 4
  • 12
2
votes
2 answers

Infinite scroll pagination and filter with hotwire

I have a table with infinite scroll working perfectly without reloading entire page. I'm now having issues with adding filter. Thanks to Phil Reynolds' article https://purpleriver.dev/posts/2022/hotwire-handbook-part-2 I was able to implement…
2
votes
1 answer

Browser Back button is not working for some feature in stimulus js

I have implemented stimulus js in rails hotwire. For other features, the browser back button is working fine, unfortunately, for the product detail page, whenever I use the browser back button, it stays on one page. After trying 2/3 times, it shows…
1
2 3