defmodule LivebookWeb.Output.GridComponent do use LivebookWeb, :live_component @impl true def mount(socket) do {:ok, stream(socket, :outputs, [])} end @impl true def update(assigns, socket) do {outputs, assigns} = Map.pop!(assigns, :outputs) socket = assign(socket, assigns) stream_items = for {idx, output} <- outputs do id = "#{idx}-grid-item" %{id: id, idx: idx, output: output} end socket = stream(socket, :outputs, stream_items) {:ok, socket} end @impl true def render(assigns) do ~H"""
""" end end