phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
6k stars 906 forks source link

Allow foreign items in stream containers #3265

Closed SteffenDE closed 1 month ago

SteffenDE commented 1 month ago

This change allows for foreign items to be rendered in a stream container. It is mainly useful for having a simple way to show an empty state, by doing something like

<div id="users" phx-update="stream">
  <div id="users-empty" class="only:block hidden">Empty!</div>
  <div :for={{id, user} <- @streams.users} id={id}><%= user.name %></div>
</div>

Closes #3260.

Non-stream items must still have a unique id.

Munksgaard commented 1 month ago

I'm excited about this change landing, good work @SteffenDE!

chrismccord commented 1 month ago

❤️❤️❤️🐥🔥