diff --git a/lib/livebook/notebook.ex b/lib/livebook/notebook.ex index 6d5f3e037..f41785455 100644 --- a/lib/livebook/notebook.ex +++ b/lib/livebook/notebook.ex @@ -653,10 +653,10 @@ defmodule Livebook.Notebook do defp add_output([], {idx, {:stdout, text}}), do: [{idx, {:stdout, normalize_stdout(text)}}] - defp add_output([], output), do: [output] - defp add_output(outputs, {_idx, :ignored}), do: outputs + defp add_output([], output), do: [output] + # Session clients prune stdout content and handle subsequent # ones by directly appending page content to the previous one defp add_output([{_idx1, {:stdout, :__pruned__}} | _] = outputs, {_idx2, {:stdout, _text}}) do diff --git a/test/livebook/notebook_test.exs b/test/livebook/notebook_test.exs index 4bc7cb0a3..06b6c48f5 100644 --- a/test/livebook/notebook_test.exs +++ b/test/livebook/notebook_test.exs @@ -402,6 +402,28 @@ defmodule Livebook.NotebookTest do {:frame, [{:text, "hola"}], %{ref: "1", type: :replace}} ) end + + test "skips ignored output" do + notebook = %{ + Notebook.new() + | sections: [ + %{ + Section.new() + | id: "s1", + cells: [%{Cell.new(:code) | id: "c1", outputs: []}] + } + ], + output_counter: 1 + } + + assert %{ + sections: [ + %{ + cells: [%{outputs: []}] + } + ] + } = Notebook.add_cell_output(notebook, "c1", :ignored) + end end describe "find_frame_outputs/2" do