Hotwire Discussion

Struggling with Hotwire Demo

To understand the details about Hotwired, I decided to go through the demo from the vide on the front page (https://hotwired.dev/). I ensured to use the same versions of Rails, Ruby and other gems than on the video, did all the steps… but…

  1. I noticed some differences
    Stimulus Javascript is stored in assets/javascript instead of javascript
    Controller has to be called reset-form instead of reset_form

  2. Destroying or creating messages from the console does not fire any callback on the frontend (while it works if I create them on the frontend)

I was therefore wondering if the source code is available? And if someone had a better (correct) tutorial.

As a side comment, gem hotwire-rails is deprecated…

I too have experienced the same issues. I’ve been cross checking with other demos, which are all quite similar or technically identical. I can’t seem to solve the second point you mention: everything is fine with multiple browsers, but no UI effect when creating from the console.
Weirdly the console log shows that ActionCable is Broadcasting to the intended stream (the only one in my little app) and with the correct action (append) and the correct target identifier.
But nothing happens in either browser window.

I couldn’t solve it, even without using the hotwire-rails Gem. The message is supposed to be broadcasted but never arrives in the browsers (this is something you can check in the network tab of Google Chrome).

Since everything is working fine in the browser (creation, deletion and update), I can live with it.