defmodule LivebookWeb.SessionLive.PersistenceComponent do use LivebookWeb, :live_component alias Livebook.{Session, SessionSupervisor, LiveMarkdown} @impl true def mount(socket) do session_summaries = SessionSupervisor.get_session_summaries() running_paths = Enum.map(session_summaries, & &1.path) {:ok, assign(socket, running_paths: running_paths)} end @impl true def update(assigns, socket) do {path, assigns} = Map.pop!(assigns, :path) {persist_outputs, assigns} = Map.pop!(assigns, :persist_outputs) attrs = %{path: path, persist_outputs: persist_outputs} socket = socket |> assign(assigns) |> assign(attrs: attrs, new_attrs: attrs) {:ok, socket} end @impl true def render(assigns) do ~H"""