Stream on table component phx 1.7+

Hi, I had a question about this from the table component from phx 1.7+ projects:

assigns =
      with %{rows: %Phoenix.LiveView.LiveStream{}} <- assigns do
        assign(assigns, row_id: assigns.row_id || fn {id, _item} -> id end)
      end

Does this mean that our assigns is converted into a LiveStream stream? And if so, does it mean that we don’t need to worry about setting our collection as a stream before passing in?

I’ve noticed that if I pass in a stream then I have to alter the rest of the table code slightly and I wasn’t sure if it’s necessary.

I’m also struggling to find documentation on LiveStream. Thanks!

2 Likes

That’s not what the code does. Those lines will add an additional :row_id assign only if the :row assign happens to be a stream. Nothing is converted to a stream within the component.

2 Likes

Thanks for clarifying! I realized just now.