From 915aea06145d6615f74127040cae10d7d5a26c9a 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/kino/frame.ex b/lib/kino/frame.ex index baf16a13..30adc56f 100644 --- a/lib/kino/frame.ex +++ b/lib/kino/frame.ex @@ -78,11 +78,14 @@ 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 +121,14 @@ 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 """