Broadcasts refreshes for complex pages (less target wiring)

6020
0

When a page has many small targets, wiring dozens of Turbo Stream operations can get noisy. Rails’ broadcasts_refreshes (Rails 7.1+) lets you take a pragmatic approach: broadcast a refresh, and Turbo morphs the page. It’s not always the right choice (you may re-render more than needed), but for complex dashboards it can be a net win in simplicity. I use it when partial-level targeting becomes brittle or when UI changes frequently. The key is pairing it with turbo_refreshes_with method: :morph so refreshes are smooth, and ensuring your page has stable IDs. Treat it as a scaling tool: start with targeted streams; move to refreshes when complexity outweighs the benefit.