From 127ef1c066647a9fea4483a81f33c565ccd23187 Mon Sep 17 00:00:00 2001
From: Simon Lafrance <122399973+SimonLafran@users.noreply.github.com>
Date: Sat, 10 Aug 2024 16:39:12 -0400
Subject: [PATCH] Add stale cells (aka single-shot cells)
Adds to PlutoRunner a new struct `Stale`. When returned from a cell,
this struct passes down its formatting to its single member `out`.
However, the cell also gets marked as stale. This means that none of the
cells that depend on it will be run. The stale cell, however, will still
be run when its dependencies run.
On the frontend stale outputs are displayed on a light or dark orange
background while stale cells and cells that depend on them get orange
traffic lights.
When a cell is in one of those two states a warning sign with an
explanatory popup is displayed below the "fold code" button.
Add a small test for stale cells
---
frontend/components/Cell.js | 55 +++++++++++-
frontend/components/Editor.js | 4 +-
frontend/editor.css | 55 ++++++++----
frontend/themes/dark.css | 2 +
frontend/themes/light.css | 46 +++++-----
src/evaluation/Run.jl | 82 +++++++++++++----
src/notebook/Cell.jl | 3 +
src/runner/PlutoRunner/src/PlutoRunner.jl | 3 +
.../PlutoRunner/src/display/format_output.jl | 6 +-
src/webserver/Dynamic.jl | 2 +
test/runtests.jl | 1 +
test/stale_cells.jl | 90 +++++++++++++++++++
12 files changed, 288 insertions(+), 61 deletions(-)
create mode 100644 test/stale_cells.jl
diff --git a/frontend/components/Cell.js b/frontend/components/Cell.js
index 615b4b8fe3..23891319d1 100644
--- a/frontend/components/Cell.js
+++ b/frontend/components/Cell.js
@@ -105,7 +105,19 @@ const on_jump = (hasBarrier, pluto_actions, cell_id) => () => {
* */
export const Cell = ({
cell_input: { cell_id, code, code_folded, metadata },
- cell_result: { queued, running, runtime, errored, output, logs, published_object_keys, depends_on_disabled_cells, depends_on_skipped_cells },
+ cell_result: {
+ queued,
+ running,
+ runtime,
+ errored,
+ output,
+ logs,
+ published_object_keys,
+ depends_on_disabled_cells,
+ depends_on_skipped_cells,
+ stale,
+ depends_on_stale_cells,
+ },
cell_dependencies,
cell_input_local,
notebook_id,
@@ -294,8 +306,10 @@ export const Cell = ({
code_folded,
skip_as_script,
running_disabled,
+ stale,
depends_on_disabled_cells,
depends_on_skipped_cells,
+ depends_on_stale_cells,
show_input,
shrunk: Object.values(logs).length > 0,
hooked_up: output?.has_pluto_hook_features ?? false,
@@ -315,9 +329,42 @@ export const Cell = ({
-
+