Remove outputs from the page on erase outputs (#878)

This commit is contained in:
Jonatan Kłosko 2022-01-17 17:13:29 +01:00 committed by GitHub
parent 0c61f4dec0
commit fe0bf660a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -64,6 +64,7 @@ defmodule Livebook.Session.Data do
evaluation_time_ms: integer() | nil,
evaluation_start: DateTime.t() | nil,
evaluation_number: non_neg_integer(),
outputs_batch_number: non_neg_integer(),
bound_to_input_ids: MapSet.t(input_id()),
bound_input_readings: input_reading()
}
@ -965,6 +966,7 @@ defmodule Livebook.Session.Data do
# :start_evaluation action
evaluation_status: :evaluating,
evaluation_number: info.evaluation_number + 1,
outputs_batch_number: info.outputs_batch_number + 1,
evaluation_digest: nil,
evaluation_snapshot: info.snapshot,
bound_to_input_ids: MapSet.new(),
@ -1107,6 +1109,9 @@ defmodule Livebook.Session.Data do
cell -> cell
end)
)
|> update_every_cell_info(fn info ->
%{info | outputs_batch_number: info.outputs_batch_number + 1}
end)
end
defp set_notebook_name({data, _} = data_actions, name) do
@ -1287,6 +1292,7 @@ defmodule Livebook.Session.Data do
evaluation_time_ms: nil,
evaluation_start: nil,
evaluation_number: 0,
outputs_batch_number: 0,
bound_to_input_ids: MapSet.new(),
bound_input_readings: [],
snapshot: {nil, nil},

View file

@ -1362,6 +1362,7 @@ defmodule LivebookWeb.SessionLive do
evaluation_time_ms: info.evaluation_time_ms,
evaluation_start: info.evaluation_start,
evaluation_number: info.evaluation_number,
outputs_batch_number: info.outputs_batch_number,
reevaluate_automatically: cell.reevaluate_automatically,
# Pass input values relevant to the given cell
input_values: input_values_for_cell(cell, data)

View file

@ -138,7 +138,7 @@ defmodule LivebookWeb.SessionLive.CellComponent do
<.editor cell_view={@cell_view} />
<div class="flex flex-col"
data-element="outputs-container"
id={"output-#{@cell_view.id}-#{@cell_view.evaluation_number}"}
id={"outputs-#{@cell_view.id}-#{@cell_view.outputs_batch_number}"}
phx-update="append">
<LivebookWeb.Output.outputs
outputs={@cell_view.outputs}