How can I reset contents of `temporary_assigns` assigns

I believe the answer you are looking for is IDs. Everything that LiveView does is based on ID. So for example, you could do this:

<div id="collection-#{@counter}" phx-update="append">
  <%= for item <- @items do %>
    ...
  <% end %>
</div>

Where @counter starts at 0.

This will work with Load More exactly as you described. Now, whenever you want to start again, bump the @counter and you should be good to go!

17 Likes