Skip to content

[Bug] Table empty state does not work with Phoenix.LiveView.LiveStream #438

Description

@Flo0807

Summary

Hey!

It looks like the empty state of the Flop.Phoenix.table component does not work when working with Phoenix.LiveView.LiveStream as a list of items.

The empty state is rendered if @items == [] (see flop_phoenix.ex), but if we pass a stream, the items assign is never an empty list, but always a Phoenix.LiveView.LiveStream struct.

Steps to reproduce

  1. Create a Phoenix.LiveView.LiveStream with no items
{:ok, {items, meta}} = MyApp.list(%{})

socket
|> stream(:items, [], reset: true)
|> assign(:meta, meta)
  1. Pass the stream to the table/1 component.
<Flop.Phoenix.table items={@streams.items} meta={@meta} path={~p"/"}>
  ...
</Flop.Phoenix.table>
  1. See empty state does not work.

Expected behaviour

The empty state of table/1 component should work with Phoenix.LiveView.LiveStream

Actual behaviour

The empty state of table/1 component is not displayed if working with Phoenix.LiveView.LiveStream.

Elixir/Erlang version

Elixir 1.18.3 (compiled with Erlang/OTP 25)

Flop and Ecto versions

  • ecto 3.12.5 (Hex package) (mix)
  • ecto_sql 3.12.1 (Hex package) (mix)
    locked at 3.12.1 (ecto_sql) aff5b958
  • flop 0.26.1 (Hex package) (mix)
    locked at 0.26.1 (flop) 5fcab8a1
  • flop_phoenix 0.24.1 (Hex package) (mix)
    locked at 0.24.1 (flop_phoenix) 543c8eb7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtable

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions