mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-13 10:28:29 +08:00
Fix intermediate output ids to not change on finished evaluation (#622)
This commit is contained in:
parent
f29a2a37a0
commit
aefe8d03c8
1 changed files with 7 additions and 1 deletions
|
@ -419,13 +419,19 @@ defmodule LivebookWeb.SessionLive.CellComponent do
|
|||
<div class="flex flex-col rounded-lg border border-gray-200 divide-y divide-gray-200">
|
||||
<%= for {output, index} <- @cell_view.outputs |> Enum.reverse() |> Enum.with_index(), output != :ignored do %>
|
||||
<div class="p-4 max-w-full overflow-y-auto tiny-scrollbar">
|
||||
<%= render_output(output, %{id: "cell-#{@cell_view.id}-evaluation#{@cell_view.number_of_evaluations}-output#{index}", socket: @socket}) %>
|
||||
<%= render_output(output, %{
|
||||
id: "cell-#{@cell_view.id}-evaluation#{evaluation_number(@cell_view.evaluation_status, @cell_view.number_of_evaluations)}-output#{index}",
|
||||
socket: @socket
|
||||
}) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
||||
defp evaluation_number(:evaluating, number_of_evaluations), do: number_of_evaluations + 1
|
||||
defp evaluation_number(_evaluation_status, number_of_evaluations), do: number_of_evaluations
|
||||
|
||||
defp render_output(text, %{id: id}) when is_binary(text) do
|
||||
# Captured output usually has a trailing newline that we can ignore,
|
||||
# because each line is itself an HTML block anyway.
|
||||
|
|
Loading…
Reference in a new issue