mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-01 12:41:43 +08:00
Clear cell outputs when moving to bin (#2312)
This commit is contained in:
parent
c0e75f64ad
commit
a0cc26fd47
2 changed files with 16 additions and 1 deletions
|
@ -1109,7 +1109,7 @@ defmodule Livebook.Session.Data do
|
|||
notebook: Notebook.delete_cell(data.notebook, cell.id),
|
||||
bin_entries: [
|
||||
%{
|
||||
cell: cell,
|
||||
cell: Map.replace(cell, :outputs, []),
|
||||
section_id: section.id,
|
||||
section_name: section.name,
|
||||
index: Enum.find_index(section.cells, &(&1 == cell)),
|
||||
|
|
|
@ -780,6 +780,21 @@ defmodule Livebook.Session.DataTest do
|
|||
refute Map.has_key?(cell_infos, "c1")
|
||||
end
|
||||
|
||||
test "does not include cell outputs in deleted cells" do
|
||||
data =
|
||||
data_after_operations!([
|
||||
{:insert_section, @cid, 0, "s1"},
|
||||
{:insert_cell, @cid, "s1", 0, :code, "c1", %{}},
|
||||
{:set_runtime, @cid, connected_noop_runtime()},
|
||||
evaluate_cells_operations(["setup", "c1"])
|
||||
])
|
||||
|
||||
operation = {:delete_cell, @cid, "c1"}
|
||||
|
||||
assert {:ok, %{bin_entries: [%{cell: %{id: "c1", outputs: []}}]}, _actions} =
|
||||
Data.apply_operation(data, operation)
|
||||
end
|
||||
|
||||
test "unqueues the cell if it's queued for evaluation" do
|
||||
data =
|
||||
data_after_operations!([
|
||||
|
|
Loading…
Reference in a new issue