Skip to content

Commit

Permalink
Remove outputs from the page on erase outputs (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko authored Jan 17, 2022
1 parent 0c61f4d commit fe0bf66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/livebook/session/data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions lib/livebook_web/live/session_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook_web/live/session_live/cell_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit fe0bf66

Please sign in to comment.