From 743cb75a2e167ec4a4449f9a708ec817192ba197 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Thu, 3 Oct 2024 13:47:13 -0500 Subject: [PATCH] Make frame render functions return the frame. --- lib/kino/frame.ex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/kino/frame.ex b/lib/kino/frame.ex index baf16a13..cc8380fb 100644 --- a/lib/kino/frame.ex +++ b/lib/kino/frame.ex @@ -78,11 +78,13 @@ defmodule Kino.Frame do updates are never a part of frame history """ - @spec render(t(), term(), keyword()) :: :ok + @spec render(t(), term(), keyword()) :: t() def render(frame, term, opts \\ []) do opts = Keyword.validate!(opts, [:to, :temporary]) destination = update_destination_from_opts!(opts) - GenServer.call(frame.pid, {:render, term, destination}, :infinity) + with :ok <- GenServer.call(frame.pid, {:render, term, destination}, :infinity) do + frame + end end defp update_destination_from_opts!(opts) do @@ -118,11 +120,13 @@ defmodule Kino.Frame do updates are never a part of frame history """ - @spec append(t(), term(), keyword()) :: :ok + @spec append(t(), term(), keyword()) :: t() def append(frame, term, opts \\ []) do opts = Keyword.validate!(opts, [:to, :temporary]) destination = update_destination_from_opts!(opts) - GenServer.call(frame.pid, {:append, term, destination}, :infinity) + with :ok <- GenServer.call(frame.pid, {:append, term, destination}, :infinity) do + frame + end end @doc """