Fix ignored output (#1323)

This commit is contained in:
Jonatan Kłosko 2022-08-02 19:33:43 +02:00 committed by GitHub
parent 4206e84682
commit 920f70817e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View file

@ -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

View file

@ -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