79278204

Date: 2024-12-13 11:53:42
Score: 0.5
Natty:
Report link

I am currently facing the same issue and think the basic setup we are using is not correct. ActionCable/TurboStreams assumes that you would have a /cable connection before you submit the job.

  1. Visit page and connect to /cable
  2. Submit form via Turbo (no page reload)
  3. Controller returns Turbo replacement for form and starts background job
  4. Background job broadcasts update to replace

Another solution might be trigger an initial update when a new connection happens on the server. This could be done with: https://api.rubyonrails.org/classes/ActionCable/Channel/Callbacks.html I believe it could be done with after_subscribe :send_update..., unless: :subscription_rejected?

Lots and lots of people have the same issue it seems by the way:

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): facing the same issue
  • Me too answer (0): have the same issue
  • High reputation (-2):
Posted by: Christopher Oezbek