Trying (and failing) to use page refreshes with morphing in Turbo 8

My goal is to have a post feed that will be automatically updated for all users. So, that’s what I try so far:

Added this in my layout:

<%= turbo_refreshes_with method: :morph, scroll: :preserve %>

<%= yield :head %>

Added the brodcasts_refreshes in the model that I want to brodacast updates:

class Post < ApplicationRecord  
      broadcasts_refreshes 
end

Then, in my index, I tried two ways: Broadcasting each post:

# index.html.erb
    <div id="posts">
      <%= render @posts  %>
    </div>
# _post.html.erb
<%= turbo_stream_from post %>

<div id="post_<%= post.id %>" class="bg-white shadow rounded-lg p-6 mb-4">
  [...]
</div>

Or broadcasting all posts without broadcasting each post:

# index.html.erb
    <%= turbo_stream_from @posts  %>
    <div id="posts">
      <%= render  %>
    </div>

Additional info: I’m using Sqlite with Litecable. In the logs I can see this when I CRUD a post: [ActiveJob] Enqueued Turbo::Streams::BroadcastStreamJob (Job ID: d38e47a7-d593-49bc-8c1d-2a0b8d5fda89) to Async(default) with arguments: "posts", {:content=>"<turbo-stream request-id=\"0b3ad242-1693-4bec-90a7-64856dc10cc0\" action=\"refresh\"></turbo-stream>"}

What is wrong with my approach?

What exactly is happening? You didn’t specify but I’m guessing that you’re simply not seeing any updates come through.

You say that you’re seeing the job be “Enqueued”. Looking at the logs, are you also seeing the broadcast job be executed?

Might be too late, but I noticed something similar. If you open another browser you should see those refreshes being actioned, it’s just that the initiating browser doesn’t go through with the refresh because it’s expecting to receive an immediate response (probably the exact same content that the other subscribers are getting via a refresh). This is achieved via the request-id in the stream. The initiating browser recognises this and ignores the refresh request.