railsjazz / rails_live_reload

Live Reload for your Rails app. The easiest way to increase your productivity.
https://www.railsjazz.com/
MIT License
318 stars 8 forks source link

Can't get this gem working? #16

Closed jacobperia closed 2 years ago

jacobperia commented 2 years ago

I tried this gem on a few of my projects that use HAML files, doesn't seem to be working. Did i miss something not in the documentation? Installed the gem and then started the server. It shows this but doesn't do anything.

Watching: /Users/jake/Repos/Nurture
  (?-mix:app\/views\/.+\.(erb|haml|slim)$) => on_change
  (?-mix:(app|vendor)\/(assets|javascript)\/\w+\/(.+\.(css|js|html|png|jpg|ts|jsx)).*) => always

https://www.loom.com/share/a34dd1367fc849c8a6b2c4c39284cf13

manastyretskyi commented 2 years ago

Hello, thanks for reporting this. I have a couple of questions:

jacobperia commented 2 years ago

Hello, thanks for reporting this. I have a couple of questions:

  • What version of the gem are you using?
  • Does it work with css or js files?

@manastyretskyi From my gemfile.lock, version

rails_live_reload (0.2.0)
      listen
      nio4r
      railties
      websocket-driver

Doesn't work with css or js files either 😕

manastyretskyi commented 2 years ago

Can you open a Network tab in your browser and search for a websocket request with path /rails/live/reload, please tell if there is one, and if it's active. The other thing that interests me, are there any errors in the browser console?

jacobperia commented 2 years ago

Can you open a Network tab in your browser and search for a websocket request with path /rails/live/reload, please tell if there is one, and if it's active. The other thing that interests me, are there any errors in the browser console?

no websockets to be seen, just one CSS request

image

no errors in rails console. just the usual static line saying Completed 200 OK.

image
manastyretskyi commented 2 years ago

Hmm... interesting I wonder if rails_live_reload scripts are included in the page at all, can you please open an Elements tab and search for element like this <script defer="" type="text/javascript" src="/rails/live/reload/script"></script> inside a <head> tag?

jacobperia commented 2 years ago

Hmm... interesting I wonder if rails_live_reload scripts are included in the page at all, can you please open an Elements tab and search for element like this <script defer="" type="text/javascript" src="/rails/live/reload/script"></script> inside a <head> tag?

yes that's there

image
manastyretskyi commented 2 years ago

Okay, now I'm a little confused If you run this document.getElementById("rails-live-reload-options") in your browser console, does it return anything?

jacobperia commented 2 years ago

yep

image
manastyretskyi commented 2 years ago

Can you make a sample repo where this problem reproduces? So that I can debug it on my own

jacobperia commented 2 years ago

Here's one i just forked and cleaned up for you. Thanks. https://github.com/jacobperia/sample-rails-app

manastyretskyi commented 2 years ago

Thanks for sharing this, now I know what the problem is. This is because you have a couple puma workers and one process just doesn't know about connections made by another one. I will look into it once I have some time.

jacobperia commented 2 years ago

Thanks for sharing this, now I know what the problem is. This is because you have a couple puma workers and one process just doesn't know about connections made by another one. I will look into it once I have some time.

Awesome ✌🏼