kirillplatonov / hotwire-livereload

Live reload gem for Hotwire Rails apps.
MIT License
467 stars 27 forks source link

Problems with reloading #16

Closed resistorsoftware closed 2 years ago

resistorsoftware commented 2 years ago

My logs show when ERB files change, no reload occurs. This is so strange! Also, my browser shows lots of problems with wss:// connections. I am really trying hard to figure out where the true issue lies! So far, no clues...


Rebuilding...
Done in 18ms.
[ActionCable] Broadcasting to hotwire-reload: {:changed=>["/Users/beers/Documents/Workspace/Apps/planty/app/views/kilts/index.html.erb"], :force_reload=>false}
[watch] build started (change: "app/javascript/application.js")
[watch] build finished
Rebuilding...
Done in 19ms.
[ActionCable] Broadcasting to hotwire-reload: {:changed=>["/Users/beers/Documents/Workspace/Apps/planty/app/javascript/application.js"], :force_reload=>true}

Example of browser messages.

    Firefox can’t establish a connection to the server at wss://myshite.test/cable. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
    The connection to wss://myshite.test/cable was interrupted while the page was loading. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
    Firefox can’t establish a connection to the server at wss://myshite.test/cable. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
    The connection to wss://myshite.test/cable was interrupted while the page was loading. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
    Firefox can’t establish a connection to the server at wss://myshite.test/cable. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
    The connection to wss://myshite.test/cable was interrupted while the page was loading. hotwire-livereload-69f109e9f29dd4f334a14c739a16f66d96595dcede55037f287ea8712288c0ae.js:226:31
lcuevastodoit commented 2 years ago

@kirillplatonov hope you have any chance to see this issue, I saw the same behavior ERB files change, no reload occurs.

kirillplatonov commented 2 years ago

@lcuevastodoit do you also use Firefox? Could you please provide examples of errors you get in the browser?

lcuevastodoit commented 2 years ago

I will getting the screen captures in a minutes but you can see rigth now in this Replit https://replit.com/@lcuevastodoit/test-hotwire-live-reloading

kirillplatonov commented 2 years ago

I will getting the screen captures in a minutes but you can see rigth now in this Replit https://replit.com/join/cumjsjoifb-lcuevastodoit

Could you please share it via public Github gist/repo? I don't have Replit account.

lcuevastodoit commented 2 years ago

I just made this video gif live-reloading

lcuevastodoit commented 2 years ago

you can fork the code in https://replit.com/@lcuevastodoit/test-hotwire-live-reloading

lcuevastodoit commented 2 years ago

also you can browse the code (no need to Login) image

lcuevastodoit commented 2 years ago

Maybe this help, when hotwire reloading is working good, it shows one Action Cable Broadcasting log and after that one Hotwire::Livereload::ReloadChannel transmitting log: image

And when is not working only send the Action Cable Broadcasting image

kirillplatonov commented 2 years ago

@lcuevastodoit it seems like there was a bug in older puma that caused issues with Action Cable broadcasting. Upgrading puma to the latest version helps to resolve this: bundle update puma

lcuevastodoit commented 2 years ago

Excelent @kirillplatonov you are the master, the problem was puma 5.6.0 Solved with puma 5.6.4

bundle update puma
Installing puma 5.6.4 (was 5.6.0) with native extensions
Removing puma (5.6.0)
Bundle updated!
~/test-hotwire-live-reloading$ bundle info puma
  * puma (5.6.4)
resistorsoftware commented 2 years ago

I am running Puma 5.6.4, yet when I change an ERB file, I see this in my console, and the hotwire-reload has not reloaded the page?

Rebuilding... 10:33:29 css.1 | Done in 14ms. 10:33:29 web.1 | [ActionCable] Broadcasting to hotwire-reload: {:changed=>["/Users/Documents/Workspace/Apps/2022/rancid_butter/app/views/transmissions/index.html.erb"], :force_reload=>false}

kirillplatonov commented 2 years ago

@resistorsoftware please provide a sample app with the reproducible issue. Without this, it's impossible to investigate what went wrong.

resistorsoftware commented 2 years ago

Impossible! I will just soldier on. Thanks!

tsaghir commented 7 months ago

Hi @resistorsoftware, have you maybe resolved your issue?