From 943d8b605979545061eb4ac1c3a61bcaeb60d1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Mon, 26 Jul 2021 11:33:44 +0200 Subject: [PATCH] Make sure to reflect the dirty status when cell content changes (#465) --- lib/livebook_web/live/session_live.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/livebook_web/live/session_live.ex b/lib/livebook_web/live/session_live.ex index b5599c7bd..1ae738ae9 100644 --- a/lib/livebook_web/live/session_live.ex +++ b/lib/livebook_web/live/session_live.ex @@ -1181,7 +1181,9 @@ defmodule LivebookWeb.SessionLive do data_view {:apply_cell_delta, _pid, cell_id, _delta, _revision} -> - update_cell_view(data_view, data, cell_id) + data_view + |> update_cell_view(data, cell_id) + |> update_dirty_status(data) _ -> data_to_view(data) @@ -1198,4 +1200,10 @@ defmodule LivebookWeb.SessionLive do cell_view ) end + + # Changes that affect only a single cell are still likely to + # have impact on dirtyness, so we need to always mirror it + defp update_dirty_status(data_view, data) do + put_in(data_view.dirty, data.dirty) + end end