Hey there,
I was running into issues in my system tests explained in Turbo Stream broadcasts happening before turbo_stream_from can establish websocket connection in System tests with Capybara - #8 by edwinthinks and the way I’ve been getting around it is by returning a turbo_frame and broadcasting. So it looks a little like this:
<% row_component = IssuesTableRow.new %>
<%= turbo_stream.replace("#{dom_id(@issue)}-row", row_component) %>
<% Turbo::StreamsChannel.broadcast_replace_later_to(@meeting, target: "#{dom_id(@issue)}-row", html: row_component.render_to_html) %>
I realize that this is also likely an anti-pattern and makes things a bit more complicated to maintain. But what I’d like to know is would this cause any user experience issues by doing it this way?
Thank you!