So it also happens with in this version (removing my own database fetch to make it fully transparent). Also, not using a layout (app.html.heex).
defmodule MyAppWeb.TempLive do
use MyAppWeb, :live_view
def mount(_, _, socket) do
posts = [
%{id: 1, message: "First post"},
%{id: 2, message: "Second post"},
%{id: 3, message: "Third post"},
%{id: 4, message: "Fourth post"},
%{id: 5, message: "Fifth post"},
%{id: 6, message: "Sixth post"},
%{id: 7, message: "Seventh post"},
%{id: 8, message: "Eighth post"},
%{id: 9, message: "Ninth post"},
%{id: 10, message: "Tenth post"}
]
{:ok, stream(socket, :posts, posts)}
end
def render(assigns) do
~H"""
<div
id="stream"
phx-update="stream"
class="flex flex-col gap-10"
>
<%= for {dom_id, post} <- @streams.posts do %>
<div id={dom_id}>
<p><%= post.message %></p>
<button phx-click="update" phx-value-id={post.id}>Click</button>
</div>
<% end %>
</div>
"""
end
def handle_event("update", %{"id" => id}, socket) do
{:noreply, stream_insert(socket, :posts, %{id: id, message: "Updated message"})}
end
end






















