From cb0546f901e24a543b7465b3c56004d49c4811c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Thu, 29 May 2025 22:47:59 +0200 Subject: [PATCH] Allow smart cells to reevaluate automatically --- lib/livebook/notebook/cell/smart.ex | 3 +++ lib/livebook_web/live/session_live.ex | 1 + lib/livebook_web/live/session_live/cell_component.ex | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/livebook/notebook/cell/smart.ex b/lib/livebook/notebook/cell/smart.ex index 3bd5978b4..d8b761958 100644 --- a/lib/livebook/notebook/cell/smart.ex +++ b/lib/livebook/notebook/cell/smart.ex @@ -15,6 +15,7 @@ defmodule Livebook.Notebook.Cell.Smart do :source, :chunks, :outputs, + :reevaluate_automatically, :kind, :attrs, :js_view, @@ -29,6 +30,7 @@ defmodule Livebook.Notebook.Cell.Smart do source: String.t() | :__pruned__, chunks: Livebook.Runtime.chunks() | nil, outputs: list(Cell.indexed_output()), + reevaluate_automatically: boolean(), kind: String.t() | nil, attrs: attrs() | :__pruned__, js_view: Livebook.Runtime.js_view() | nil, @@ -47,6 +49,7 @@ defmodule Livebook.Notebook.Cell.Smart do source: "", chunks: nil, outputs: [], + reevaluate_automatically: false, kind: nil, attrs: %{}, js_view: nil, diff --git a/lib/livebook_web/live/session_live.ex b/lib/livebook_web/live/session_live.ex index 6e8f51ab1..bf021f0c9 100644 --- a/lib/livebook_web/live/session_live.ex +++ b/lib/livebook_web/live/session_live.ex @@ -1978,6 +1978,7 @@ defmodule LivebookWeb.SessionLive do type: :smart, empty: cell.source == "", eval: eval_info_to_view(cell, info.eval, data, changed_input_ids), + reevaluate_automatically: cell.reevaluate_automatically, status: info.status, js_view: cell.js_view, editor: diff --git a/lib/livebook_web/live/session_live/cell_component.ex b/lib/livebook_web/live/session_live/cell_component.ex index 032ac2aec..a3f11b645 100644 --- a/lib/livebook_web/live/session_live/cell_component.ex +++ b/lib/livebook_web/live/session_live/cell_component.ex @@ -249,7 +249,7 @@ defmodule LivebookWeb.SessionLive.CellComponent do cell_id={@cell_view.id} validity={@cell_view.eval.validity} status={@cell_view.eval.status} - reevaluate_automatically={false} + reevaluate_automatically={@cell_view.reevaluate_automatically} reevaluates_automatically={@cell_view.eval.reevaluates_automatically} />