This raises an error because I don’t have a partial for the model in the expected partial_path. However, my expectation is that this shouldn’t matter - I’m sending the HTML fragment, so I don’t want any partial rendering.
If I call the module method directly (Turbo::StreamsChannel.broadcast_update_later_to), the attempt to wrap the content in a partial is bypassed. But this seems like it shouldn’t be necessary.
I also attempted adding partial: false and partial: nil but Turbo still attempts to find and render the partial.
Can anyone help me understand why my expectation is faulty, or perhaps some other way to broadcast an HTML fragment without getting any partial nonsense involved?
Have you tried hard-coding some HTML instead? Just to make sure it is not Turbo-rails (which I assume you use). Also sure you are on a version that supports the html-key.
Bit low-level ideas, but your code seems to be correct on first glance.
I tried swapping out the self.html_column with a string, yes - is that what you mean by hard-coding HTML?
We are not on the latest turbo-rails, but we are on 2.0.5 which does have the html key in Turbo::Broadcastable.
I’ve been using Turbo for a while but I’ve never had to send raw html like this so I certainly could be confused as to how it should work. I’m interpreting this comment in Turbo::Broadcastable
You can also choose to render html instead of a partial inside of a broadcast
The “instead” part is what makes me believe passing the html key would forgo all attempts to find and render partials for the broadcast.
It sure is possible—I have done it many times. It’s why I suggested trying something simple like: html: "<p>I am working.</p>. If that works the problem might be elsewhere—not sure why (you haven’t shared the exact error it gives + any possible backtrace).
I didn’t share the specific error and backtrace because I assumed it was an issue in either how I was implementing the broadcast, or that my expectation was flawed.
I’ve reverted the change, and it now no longer raises the Missing Partial error. So apparently it was something I was doing, but in the course of restarting the server or accessory processes, whatever I bungled cleared itself out.
I’ll spend a few minutes trying to reproduce to find a root cause. But I suppose I just overlooked something somewhere. I appreciate your help and confirming that the broadcast was written correctly.