@marimo-team/islands 0.25.3-dev273 → 0.25.3-dev279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-eLHPh6uu.js → ConnectedDataExplorerComponent-CErm132k.js} +25 -26
- package/dist/{ErrorBoundary-DBh-wUT9.js → ErrorBoundary-DmTMuDPR.js} +43 -44
- package/dist/{abnfDiagram-VCTEODGH-hqd0IBtX.js → abnfDiagram-VCTEODGH-d-Qn2fwb.js} +2 -2
- package/dist/{any-language-editor-DnG26QXh.js → any-language-editor-6k6F12Z3.js} +3 -3
- package/dist/{architectureDiagram-5GKGNRK7-BzLAFcc0.js → architectureDiagram-5GKGNRK7-DxragHYv.js} +1 -1
- package/dist/{assertNever-DIU3JJbt.js → assertNever-B-YzWzbL.js} +14 -14
- package/dist/{button-0-RqY1DW.js → button-DZuNnIZO.js} +220 -223
- package/dist/{capabilities-B6yy_CBN.js → capabilities-D9FskwsK.js} +1 -1
- package/dist/{chat-ui-BWIkve2R.js → chat-ui-v1Fdh0NA.js} +332 -333
- package/dist/{check-gUSZbRsl.js → check-XFzZeH-y.js} +1 -1
- package/dist/{chunk-IMKFNOWR-DOeVvuyE.js → chunk-IMKFNOWR-C0x0feFg.js} +1 -1
- package/dist/{chunk-SHT3W25Y-DZoFI8wR.js → chunk-SHT3W25Y-D0ZdASqB.js} +1 -1
- package/dist/{chunk-SVP7TREG-CWu86PSW.js → chunk-SVP7TREG-BHjL96zx.js} +1 -1
- package/dist/{chunk-TICWLB2K-BrM0GoP3.js → chunk-TICWLB2K-CzcrwGfp.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-DYi4V2bB.js → classDiagram-ZZMXUADV-BTqFAZTP.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-tN7FIk-m.js → classDiagram-v2-VYDZK3BY-EPXb0Elt.js} +2 -2
- package/dist/{code-visibility-M_dXDGp6.js → code-visibility-Dw4-TXN0.js} +20 -20
- package/dist/{common-DV0fvw_I.js → common-BXMFi4lr.js} +5399 -5397
- package/dist/{config-BsPruWMR.js → config-C8MFHQ2E.js} +23 -22
- package/dist/{copy-icon-C2I8sw4h.js → copy-icon-CtllOdmg.js} +3 -3
- package/dist/{createReducer-DdtT_7ji.js → createReducer-DRqwmaTc.js} +2 -2
- package/dist/{cynefinDiagram-5FMLGOSQ-D5nCnDc-.js → cynefinDiagram-5FMLGOSQ-CBSD344q.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-BHkd7f_i.js → dagre-GXQ25YYZ-JItjh3Ge.js} +1 -1
- package/dist/{data-grid-overlay-editor-Cd1zGKBt.js → data-grid-overlay-editor-hZzwX7Ia.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-D1ALppT2.js → diagram-S7CK7UJ4-CTD9xTVb.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DLv0b83L.js → diagram-UQ7AKVKN-DTfnFai8.js} +1 -1
- package/dist/{diagram-VX7I27RA-7XJ7J6qg.js → diagram-VX7I27RA-BcSnucV-.js} +1 -1
- package/dist/{diagram-Z3DM3KII-7M7zbHp_.js → diagram-Z3DM3KII-C2ATIE8A.js} +1 -1
- package/dist/{dialog-DzCj1qQv.js → dialog-CaYm5imE.js} +33 -33
- package/dist/{dropdown-menu-CdXE15an.js → dropdown-menu-Bb0bFOIk.js} +149 -149
- package/dist/{ebnfDiagram-PWID7BFC-DHH1qlmV.js → ebnfDiagram-PWID7BFC-B7B9JPxc.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-fI_0dGef.js → erDiagram-RLTQ6QDP-v6hDno1O.js} +1 -1
- package/dist/{error-banner-DPc9eIw5.js → error-banner-CHCdHVFB.js} +44 -45
- package/dist/{error-entries-CxN-Nq3V.js → error-entries-C1S-Rmyt.js} +563 -554
- package/dist/{feedback-button-CE2gPi4-.js → feedback-button-6Ui2TDLR.js} +12 -12
- package/dist/{flowDiagram-HODETNUW-Brg9MA6i.js → flowDiagram-HODETNUW-aIFlAtOy.js} +2 -2
- package/dist/{formats-DbSvAPY-.js → formats-PzBQMUnr.js} +3 -3
- package/dist/{glide-data-editor-BycATbgF.js → glide-data-editor-PZNlrSDI.js} +14 -16
- package/dist/{glide-utils-BSw3SSHF.js → glide-utils-BSQr4d90.js} +51 -59
- package/dist/{globals-CW6OvnI5.js → globals-DX6FPZYq.js} +3 -3
- package/dist/{html-to-image-Bc2AvXHG.js → html-to-image-CqGUd58T.js} +14529 -14531
- package/dist/{infoDiagram-27XIBGKW-E9e403YT.js → infoDiagram-27XIBGKW-D6YHLeCP.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-C-RlYDRo.js → ishikawaDiagram-5VMMS53U-D1ZvprOX.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CLFl_uqK.js → kanban-definition-UXKFOSKX-Bna_3BMr.js} +1 -1
- package/dist/{loader-BVEtQ4F3.js → loader-DZvtzQoD.js} +1 -1
- package/dist/main.js +7357 -7361
- package/dist/{mermaid-rd09e1JL.js → mermaid-A36unKXJ.js} +50 -50
- package/dist/{mindmap-definition-YA3MSWOX-BQ8TWtyB.js → mindmap-definition-YA3MSWOX-CyVCs__G.js} +1 -1
- package/dist/{number-overlay-editor-B_rR-LdM.js → number-overlay-editor-D0CsL3_R.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CN8UHFPi.js → pegDiagram-XKGWAZYB-9hNBD2wZ.js} +2 -2
- package/dist/{pencil-DcT8AE0h.js → pencil-DYUlSKxZ.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-DGuJ0EBd.js → pieDiagram-E7YTZNPT-8tr-NYo7.js} +1 -1
- package/dist/{process-output-qecD7Dk8.js → process-output-DskX9jLa.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-BPDA8wy8.js → railroadDiagram-O6MQD6OU-Dzg1dyyp.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-ChzLGbGW.js → requirementDiagram-BXWQKSXE-B7sNqwGG.js} +1 -1
- package/dist/{reveal-component-CngVwOSy.js → reveal-component-D7xeI1QR.js} +1003 -1003
- package/dist/{select-OxgozOC8.js → select-DsoP1qe8.js} +290 -290
- package/dist/{sequenceDiagram-WJ2MYXX4-DFX-bE6O.js → sequenceDiagram-WJ2MYXX4-oP9shbaG.js} +1 -1
- package/dist/{spec-oJn0RhpQ.js → spec-BZMDxAu7.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-BR7cI3wK.js → stateDiagram-D77RDMKH-CjCv4ogv.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-oGqB5UDI.js → stateDiagram-v2-MP3YSRHH-BW9X162a.js} +2 -2
- package/dist/{static-state-CuV6Pc3a.js → static-state-D-Q-Ajaa.js} +8 -8
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-DwSZl1yC.js → swimlanes-42K2YHIH-Ckfs9Wrn.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-BHlcd-Ri.js → swimlanesDiagram-VR7AAH4N-DpTNG9YP.js} +2 -2
- package/dist/{swiper-component-Dvj-goaD.js → swiper-component-DQbK_ZWm.js} +7 -7
- package/dist/{timeline-definition-24CTP7MA-DMmP-G2O.js → timeline-definition-24CTP7MA-BXaBlV6U.js} +1 -1
- package/dist/{toast-DbBHmxmB.js → toast-BhjIy3Tq.js} +158 -158
- package/dist/{tooltip-BfcDQd2j.js → tooltip-DMMiOn2f.js} +64 -64
- package/dist/use-restore-focus-CosX7-gx.js +7568 -0
- package/dist/{useAsyncData-BYIAoMqn.js → useAsyncData-Ci4AvJff.js} +4 -4
- package/dist/{useDateFormatter-ButWkdcK.js → useDateFormatter-CPlava52.js} +2 -2
- package/dist/{useDeepCompareMemoize-Bz0c5GN6.js → useDeepCompareMemoize-NaaWoFlX.js} +1 -1
- package/dist/useEvent-BRH-aCqi.js +19 -0
- package/dist/{useIframeCapabilities-BIolGsF1.js → useIframeCapabilities-BXhDDoCG.js} +1 -1
- package/dist/{useLifecycle-JjxCC7Vu.js → useLifecycle-SniivYmC.js} +2 -2
- package/dist/{vega-component-rxIxAAh9.js → vega-component-DIxaDQNs.js} +40 -40
- package/dist/{vennDiagram-4TSXK5OY-Db8GtH1G.js → vennDiagram-4TSXK5OY-C-hQ4iNJ.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DmIiC3FU.js → wardleyDiagram-VM6X3IG4-C2MQ_Umv.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-DS9OPrNq.js → xychartDiagram-S5SC5T6Z-BtTTBn7Q.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +4 -2
- package/src/__mocks__/notebook.ts +0 -2
- package/src/__tests__/CellStatus.test.tsx +6 -6
- package/src/components/editor/__tests__/data-attributes.test.tsx +0 -2
- package/src/components/editor/__tests__/output-persistence.test.tsx +20 -5
- package/src/components/editor/cell/CellStatus.tsx +6 -5
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +169 -0
- package/src/components/editor/cell/collapse.tsx +3 -4
- package/src/components/editor/cell/useRunCells.ts +32 -3
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -3
- package/src/components/editor/notebook-cell.tsx +23 -37
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +4 -10
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -2
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +8 -5
- package/src/components/slides/minimap.tsx +3 -2
- package/src/components/slides/reveal-component.tsx +3 -2
- package/src/components/slides/slide-cell-view.tsx +8 -8
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -101
- package/src/core/cells/__tests__/actions.test.ts +0 -1
- package/src/core/cells/__tests__/cell.test.ts +81 -17
- package/src/core/cells/__tests__/cells.test.ts +0 -100
- package/src/core/cells/__tests__/document.test.ts +2 -8
- package/src/core/cells/__tests__/utils.test.ts +93 -24
- package/src/core/cells/actions.ts +0 -1
- package/src/core/cells/cell.ts +37 -14
- package/src/core/cells/cells.ts +10 -99
- package/src/core/cells/document.ts +2 -13
- package/src/core/cells/types.ts +0 -23
- package/src/core/cells/utils.ts +44 -17
- package/src/core/codemirror/cells/extensions.ts +0 -14
- package/src/core/errors/__tests__/error-entries.test.ts +40 -1
- package/src/core/errors/error-entries.ts +2 -3
- package/src/core/executions/__tests__/freshness.test.ts +420 -0
- package/src/core/executions/__tests__/hooks.test.tsx +106 -0
- package/src/core/executions/atoms.ts +22 -0
- package/src/core/executions/freshness.ts +164 -0
- package/src/core/executions/hooks.ts +17 -1
- package/src/core/executions/index.ts +3 -1
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/islands/components/__tests__/web-components.test.tsx +63 -0
- package/src/core/islands/components/web-components.tsx +11 -0
- package/src/core/kernel/handlers.ts +0 -4
- package/src/core/session/useNotebookSession.tsx +2 -7
- package/src/css/globals.css +6 -2
- package/src/plugins/impl/DataEditorPlugin.tsx +0 -4
- package/src/plugins/impl/data-editor/__tests__/column-types.test.ts +5 -0
- package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +9 -5
- package/src/plugins/impl/data-editor/column-types.ts +3 -0
- package/src/plugins/impl/data-editor/glide-data-editor.tsx +6 -5
- package/src/plugins/impl/data-editor/glide-utils.ts +10 -32
- package/src/plugins/impl/data-editor/types.ts +0 -2
- package/src/stories/cell-status.stories.tsx +12 -14
- package/src/stories/cell.stories.tsx +44 -10
- package/src/stories/layout/vertical/one-column.stories.tsx +0 -10
- package/src/theme/__tests__/islands-theme.test.tsx +276 -0
- package/src/theme/namespace.tsx +4 -3
- package/src/theme/useTheme.ts +71 -41
- package/dist/schemas-CdscWNy_.js +0 -4747
- package/dist/use-restore-focus-CmflVLWJ.js +0 -1672
- package/dist/useTheme-DPLobSFs.js +0 -339
- package/dist/utils-EBklsC5R.js +0 -813
- package/src/components/editor/cell/__tests__/useRunCells.test.ts +0 -45
|
@@ -14,11 +14,10 @@ import { memo } from "react";
|
|
|
14
14
|
import { Toolbar } from "@/components/layout/toolbar";
|
|
15
15
|
import { Button } from "@/components/ui/button";
|
|
16
16
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
17
|
-
import { useNotebook } from "@/core/cells/cells";
|
|
18
17
|
import { columnOf, useLayout } from "@/core/cells/layout";
|
|
19
18
|
import type { CellId } from "@/core/cells/ids";
|
|
20
19
|
import { getDescendantsStatus } from "@/core/cells/utils";
|
|
21
|
-
import { cellExecutionInputsAtom } from "@/core/executions";
|
|
20
|
+
import { cellExecutionInputsAtom, cellFreshnessAtom } from "@/core/executions";
|
|
22
21
|
import { cn } from "@/utils/cn";
|
|
23
22
|
|
|
24
23
|
interface Props {
|
|
@@ -66,12 +65,12 @@ export const CollapsedCellBanner: React.FC<{
|
|
|
66
65
|
cellId: CellId;
|
|
67
66
|
count: number;
|
|
68
67
|
}> = memo(({ onClick, count, cellId }) => {
|
|
69
|
-
const notebook = useNotebook();
|
|
70
68
|
const executions = useAtomValue(cellExecutionInputsAtom);
|
|
69
|
+
const freshness = useAtomValue(cellFreshnessAtom);
|
|
71
70
|
const layout = useLayout();
|
|
72
71
|
const states = getDescendantsStatus(
|
|
73
|
-
notebook,
|
|
74
72
|
executions,
|
|
73
|
+
freshness,
|
|
75
74
|
columnOf(layout, cellId).folds.get(cellId) ?? [],
|
|
76
75
|
);
|
|
77
76
|
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
import { closeCompletion } from "@codemirror/autocomplete";
|
|
4
4
|
import { atom, useSetAtom } from "jotai";
|
|
5
5
|
import useEvent from "react-use-event-hook";
|
|
6
|
+
import { toast } from "@/components/ui/use-toast";
|
|
6
7
|
import { getNotebook, type NotebookState } from "@/core/cells/cells";
|
|
7
8
|
import { useCellActions } from "@/core/cells/actions";
|
|
8
9
|
import type { CellId } from "@/core/cells/ids";
|
|
9
10
|
import { enabledCellIds, staleCellIds } from "@/core/cells/utils";
|
|
10
11
|
import {
|
|
11
12
|
cellExecutionInputsAtom,
|
|
13
|
+
cellFreshnessAtom,
|
|
12
14
|
submitCells,
|
|
13
15
|
withdrawCells,
|
|
14
16
|
} from "@/core/executions";
|
|
@@ -16,6 +18,7 @@ import { getCurrentLanguageAdapter } from "@/core/codemirror/language/commands";
|
|
|
16
18
|
import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
|
|
17
19
|
import { useRequestClient } from "@/core/network/requests";
|
|
18
20
|
import type { ExecuteCellsRequest } from "@/core/network/types";
|
|
21
|
+
import { activeDocumentModelAtom } from "@/core/session/active-notebook";
|
|
19
22
|
import { store } from "@/core/state/jotai";
|
|
20
23
|
import { Logger } from "@/utils/Logger";
|
|
21
24
|
|
|
@@ -26,9 +29,35 @@ export const hasRunAnyCellAtom = atom<boolean>(false);
|
|
|
26
29
|
*/
|
|
27
30
|
export function useRunStaleCells() {
|
|
28
31
|
const runCells = useRunCells();
|
|
29
|
-
const runStaleCells = useEvent(() =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const runStaleCells = useEvent(async () => {
|
|
33
|
+
// Freshness reads the confirmed document, so an edit still in flight
|
|
34
|
+
// reaches the host before the stale cells are chosen.
|
|
35
|
+
const model = store.get(activeDocumentModelAtom);
|
|
36
|
+
try {
|
|
37
|
+
await model?.flush();
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (store.get(activeDocumentModelAtom) !== model) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
Logger.warn("Running stale cells with unsynced edits", error);
|
|
43
|
+
toast({
|
|
44
|
+
title: "Edits not yet synced",
|
|
45
|
+
description: "Stale cells were chosen from the last synced source.",
|
|
46
|
+
variant: "danger",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// The request was for the notebook that was open when it was made.
|
|
50
|
+
if (store.get(activeDocumentModelAtom) !== model) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
return runCells(
|
|
54
|
+
staleCellIds(
|
|
55
|
+
getNotebook(),
|
|
56
|
+
store.get(cellExecutionInputsAtom),
|
|
57
|
+
store.get(cellFreshnessAtom),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
});
|
|
32
61
|
return runStaleCells;
|
|
33
62
|
}
|
|
34
63
|
|
|
@@ -418,7 +418,7 @@ describe("SendErrorReportButton", () => {
|
|
|
418
418
|
store.set(
|
|
419
419
|
notebookAtom,
|
|
420
420
|
MockNotebook.notebookState({
|
|
421
|
-
cellData: { [CELL_ID]: { code: CODE
|
|
421
|
+
cellData: { [CELL_ID]: { code: CODE } },
|
|
422
422
|
cellRuntime: { [CELL_ID]: { output } },
|
|
423
423
|
}),
|
|
424
424
|
);
|
|
@@ -429,7 +429,6 @@ describe("SendErrorReportButton", () => {
|
|
|
429
429
|
[CELL_ID]: {
|
|
430
430
|
...state.cellData[CELL_ID],
|
|
431
431
|
code: "print('edited')",
|
|
432
|
-
edited: true,
|
|
433
432
|
},
|
|
434
433
|
},
|
|
435
434
|
}));
|
|
@@ -466,7 +465,7 @@ describe("SendErrorReportButton", () => {
|
|
|
466
465
|
notebookAtom,
|
|
467
466
|
MockNotebook.notebookState({
|
|
468
467
|
cellData: {
|
|
469
|
-
[CELL_ID]: { code: "unrelated edit"
|
|
468
|
+
[CELL_ID]: { code: "unrelated edit" },
|
|
470
469
|
},
|
|
471
470
|
cellRuntime: {
|
|
472
471
|
[CELL_ID]: {
|
|
@@ -25,7 +25,11 @@ import { StopButton } from "@/components/editor/cell/StopButton";
|
|
|
25
25
|
import { Toolbar, ToolbarItem } from "@/components/editor/cell/toolbar";
|
|
26
26
|
import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
|
|
27
27
|
import { aiCompletionCellAtom } from "@/core/ai/state";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
consoleOutputIsStale,
|
|
30
|
+
outputIsLoading,
|
|
31
|
+
outputIsStale,
|
|
32
|
+
} from "@/core/cells/cell";
|
|
29
33
|
import { isOutputEmpty } from "@/core/cells/outputs";
|
|
30
34
|
import { useIsPendingCut } from "@/core/cells/pending-cut-service";
|
|
31
35
|
import { autocompletionKeymap } from "@/core/codemirror/cm";
|
|
@@ -39,8 +43,10 @@ import { connectionAtom } from "@/core/network/connection";
|
|
|
39
43
|
import { useRequestClient } from "@/core/network/requests";
|
|
40
44
|
import {
|
|
41
45
|
type CellExecutionView,
|
|
46
|
+
type CellFreshness,
|
|
42
47
|
type CellRunStatus,
|
|
43
48
|
useCellExecution,
|
|
49
|
+
useCellFreshness,
|
|
44
50
|
} from "@/core/executions";
|
|
45
51
|
import type { CellConfig } from "@/core/network/types";
|
|
46
52
|
import { useResizeObserver } from "@/hooks/useResizeObserver";
|
|
@@ -320,6 +326,7 @@ const ReadonlyCellComponent = forwardRef(
|
|
|
320
326
|
const cellData = useCellData(cellId);
|
|
321
327
|
const cellRuntime = useCellRuntime(cellId);
|
|
322
328
|
const execution = useCellExecution(cellId);
|
|
329
|
+
const freshness = useCellFreshness(cellId);
|
|
323
330
|
const errored = execution.outcome === "error";
|
|
324
331
|
const interrupted = execution.outcome === "interrupted";
|
|
325
332
|
const stopped = execution.outcome === "skipped";
|
|
@@ -354,11 +361,7 @@ const ReadonlyCellComponent = forwardRef(
|
|
|
354
361
|
className={CSSClasses.outputArea}
|
|
355
362
|
cellId={cellId}
|
|
356
363
|
output={cellRuntime.output}
|
|
357
|
-
stale={outputIsStale(
|
|
358
|
-
execution,
|
|
359
|
-
cellRuntime.staleInputs,
|
|
360
|
-
cellData.edited,
|
|
361
|
-
)}
|
|
364
|
+
stale={outputIsStale(execution, freshness, true)}
|
|
362
365
|
loading={outputIsLoading(execution.status)}
|
|
363
366
|
/>
|
|
364
367
|
</div>
|
|
@@ -387,6 +390,7 @@ const EditableCellComponent = ({
|
|
|
387
390
|
const cellData = useCellData(cellId);
|
|
388
391
|
const cellRuntime = useCellRuntime(cellId);
|
|
389
392
|
const execution = useCellExecution(cellId);
|
|
393
|
+
const freshness = useCellFreshness(cellId);
|
|
390
394
|
const errored = execution.outcome === "error";
|
|
391
395
|
const interrupted = execution.outcome === "interrupted";
|
|
392
396
|
const stopped = execution.outcome === "skipped";
|
|
@@ -408,9 +412,8 @@ const EditableCellComponent = ({
|
|
|
408
412
|
const uninstantiated = isUninstantiated(execution);
|
|
409
413
|
|
|
410
414
|
const needsRun = cellNeedsRun({
|
|
411
|
-
|
|
415
|
+
freshness,
|
|
412
416
|
interrupted,
|
|
413
|
-
staleInputs: cellRuntime.staleInputs,
|
|
414
417
|
disabled: cellData.config.disabled,
|
|
415
418
|
blocked: execution.blocked,
|
|
416
419
|
});
|
|
@@ -441,11 +444,7 @@ const EditableCellComponent = ({
|
|
|
441
444
|
|
|
442
445
|
// console output is cleared immediately on run, so check for queued instead
|
|
443
446
|
// of loading to determine staleness
|
|
444
|
-
const consoleOutputStale =
|
|
445
|
-
(execution.status === "queued" ||
|
|
446
|
-
cellData.edited ||
|
|
447
|
-
cellRuntime.staleInputs) &&
|
|
448
|
-
!interrupted;
|
|
447
|
+
const consoleOutputStale = consoleOutputIsStale(execution, freshness);
|
|
449
448
|
|
|
450
449
|
// This getter is called during render, so useEvent cannot be used here.
|
|
451
450
|
// oxlint-disable-next-line react/preserve-manual-memoization
|
|
@@ -481,11 +480,7 @@ const EditableCellComponent = ({
|
|
|
481
480
|
const hasOutput = !isOutputEmpty(cellRuntime.output);
|
|
482
481
|
// While presenting, pending edits do not dim the output as stale,
|
|
483
482
|
// matching the read view.
|
|
484
|
-
const isStaleCell = outputIsStale(
|
|
485
|
-
execution,
|
|
486
|
-
cellRuntime.staleInputs,
|
|
487
|
-
cellData.edited && !isPresenting,
|
|
488
|
-
);
|
|
483
|
+
const isStaleCell = outputIsStale(execution, freshness, !isPresenting);
|
|
489
484
|
const hasConsoleOutput = cellRuntime.consoleOutputs.length > 0;
|
|
490
485
|
const cellOutput = userConfig.display.cell_output;
|
|
491
486
|
|
|
@@ -685,7 +680,7 @@ const EditableCellComponent = ({
|
|
|
685
680
|
<StagedAIDeletionMarker cellId={cellId} />
|
|
686
681
|
<div className="absolute right-2 -top-4 z-10">
|
|
687
682
|
<CellToolbar
|
|
688
|
-
edited={
|
|
683
|
+
edited={freshness.sourceChanged}
|
|
689
684
|
status={execution.status}
|
|
690
685
|
blocked={execution.blocked}
|
|
691
686
|
cellConfig={cellData.config}
|
|
@@ -725,12 +720,11 @@ const EditableCellComponent = ({
|
|
|
725
720
|
className={cn(
|
|
726
721
|
isMarkdownCodeHidden && cellOutput === "below" && "top-14",
|
|
727
722
|
)}
|
|
728
|
-
edited={cellData.edited}
|
|
729
723
|
execution={execution}
|
|
724
|
+
freshness={freshness}
|
|
730
725
|
isCellStatusInline={isCellStatusInline}
|
|
731
726
|
uninstantiated={uninstantiated}
|
|
732
727
|
disabled={cellData.config.disabled}
|
|
733
|
-
staleInputs={cellRuntime.staleInputs}
|
|
734
728
|
/>
|
|
735
729
|
)}
|
|
736
730
|
<div className="shoulder-bottom hover-action">
|
|
@@ -860,29 +854,26 @@ const CellRightSideActions = memo(
|
|
|
860
854
|
(props: {
|
|
861
855
|
className?: string;
|
|
862
856
|
disabled: boolean | undefined;
|
|
863
|
-
edited: boolean;
|
|
864
857
|
execution: CellExecutionView;
|
|
858
|
+
freshness: CellFreshness;
|
|
865
859
|
isCellStatusInline: boolean;
|
|
866
|
-
staleInputs: boolean;
|
|
867
860
|
uninstantiated: boolean;
|
|
868
861
|
}) => {
|
|
869
862
|
const {
|
|
870
863
|
className,
|
|
871
864
|
disabled = false,
|
|
872
|
-
edited,
|
|
873
865
|
execution,
|
|
866
|
+
freshness,
|
|
874
867
|
isCellStatusInline,
|
|
875
|
-
staleInputs,
|
|
876
868
|
uninstantiated,
|
|
877
869
|
} = props;
|
|
878
870
|
|
|
879
871
|
const cellStatusComponent = (
|
|
880
872
|
<CellStatusComponent
|
|
881
873
|
status={execution.status}
|
|
882
|
-
|
|
874
|
+
freshness={freshness}
|
|
883
875
|
interrupted={execution.outcome === "interrupted"}
|
|
884
876
|
editing={true}
|
|
885
|
-
edited={edited}
|
|
886
877
|
disabled={disabled}
|
|
887
878
|
elapsedTime={execution.duration}
|
|
888
879
|
startedAt={execution.startedAt}
|
|
@@ -1059,6 +1050,7 @@ const SetupCellComponent = ({
|
|
|
1059
1050
|
const cellData = useCellData(cellId);
|
|
1060
1051
|
const cellRuntime = useCellRuntime(cellId);
|
|
1061
1052
|
const execution = useCellExecution(cellId);
|
|
1053
|
+
const freshness = useCellFreshness(cellId);
|
|
1062
1054
|
const errored = execution.outcome === "error";
|
|
1063
1055
|
const interrupted = execution.outcome === "interrupted";
|
|
1064
1056
|
const stopped = execution.outcome === "skipped";
|
|
@@ -1076,9 +1068,8 @@ const SetupCellComponent = ({
|
|
|
1076
1068
|
const uninstantiated = isUninstantiated(execution);
|
|
1077
1069
|
|
|
1078
1070
|
const needsRun = cellNeedsRun({
|
|
1079
|
-
|
|
1071
|
+
freshness,
|
|
1080
1072
|
interrupted,
|
|
1081
|
-
staleInputs: cellRuntime.staleInputs,
|
|
1082
1073
|
disabled: cellData.config.disabled,
|
|
1083
1074
|
blocked: execution.blocked,
|
|
1084
1075
|
});
|
|
@@ -1087,11 +1078,7 @@ const SetupCellComponent = ({
|
|
|
1087
1078
|
|
|
1088
1079
|
// console output is cleared immediately on run, so check for queued instead
|
|
1089
1080
|
// of loading to determine staleness
|
|
1090
|
-
const consoleOutputStale =
|
|
1091
|
-
(execution.status === "queued" ||
|
|
1092
|
-
cellData.edited ||
|
|
1093
|
-
cellRuntime.staleInputs) &&
|
|
1094
|
-
!interrupted;
|
|
1081
|
+
const consoleOutputStale = consoleOutputIsStale(execution, freshness);
|
|
1095
1082
|
|
|
1096
1083
|
// This getter is called during render, so useEvent cannot be used here.
|
|
1097
1084
|
// oxlint-disable-next-line react/preserve-manual-memoization
|
|
@@ -1199,7 +1186,7 @@ const SetupCellComponent = ({
|
|
|
1199
1186
|
<StagedAIDeletionMarker cellId={cellId} />
|
|
1200
1187
|
<div className="absolute right-2 -top-4 z-10">
|
|
1201
1188
|
<CellToolbar
|
|
1202
|
-
edited={
|
|
1189
|
+
edited={freshness.sourceChanged}
|
|
1203
1190
|
status={execution.status}
|
|
1204
1191
|
blocked={execution.blocked}
|
|
1205
1192
|
cellConfig={cellData.config}
|
|
@@ -1237,12 +1224,11 @@ const SetupCellComponent = ({
|
|
|
1237
1224
|
frame for running cells. */}
|
|
1238
1225
|
{!isPresenting && (
|
|
1239
1226
|
<CellRightSideActions
|
|
1240
|
-
edited={cellData.edited}
|
|
1241
1227
|
execution={execution}
|
|
1228
|
+
freshness={freshness}
|
|
1242
1229
|
isCellStatusInline={false}
|
|
1243
1230
|
uninstantiated={uninstantiated}
|
|
1244
1231
|
disabled={cellData.config.disabled}
|
|
1245
|
-
staleInputs={cellRuntime.staleInputs}
|
|
1246
1232
|
/>
|
|
1247
1233
|
)}
|
|
1248
1234
|
<div className="shoulder-bottom hover-action">
|
|
@@ -37,7 +37,7 @@ import { NumberField } from "@/components/ui/number-field";
|
|
|
37
37
|
import { Switch } from "@/components/ui/switch";
|
|
38
38
|
import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
|
|
39
39
|
import type { CellId } from "@/core/cells/ids";
|
|
40
|
-
import { useCellExecution } from "@/core/executions";
|
|
40
|
+
import { useCellExecution, useCellFreshness } from "@/core/executions";
|
|
41
41
|
import type { AppMode } from "@/core/mode";
|
|
42
42
|
import { useIsDragging } from "@/hooks/useIsDragging";
|
|
43
43
|
import { cn } from "@/utils/cn";
|
|
@@ -228,7 +228,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
|
|
|
228
228
|
mode={mode}
|
|
229
229
|
cellId={cell.id}
|
|
230
230
|
output={cell.output}
|
|
231
|
-
staleInputs={cell.staleInputs}
|
|
232
231
|
hideWithoutValue={true}
|
|
233
232
|
isScrollable={isScrollable}
|
|
234
233
|
side={side}
|
|
@@ -294,7 +293,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
|
|
|
294
293
|
mode={mode}
|
|
295
294
|
cellId={cell.id}
|
|
296
295
|
output={cell.output}
|
|
297
|
-
staleInputs={cell.staleInputs}
|
|
298
296
|
hideWithoutValue={false}
|
|
299
297
|
isScrollable={false}
|
|
300
298
|
/>
|
|
@@ -363,7 +361,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
|
|
|
363
361
|
mode={mode}
|
|
364
362
|
cellId={cell.id}
|
|
365
363
|
output={cell.output}
|
|
366
|
-
staleInputs={cell.staleInputs}
|
|
367
364
|
hideWithoutValue={false}
|
|
368
365
|
isScrollable={false}
|
|
369
366
|
/>
|
|
@@ -375,10 +372,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
|
|
|
375
372
|
);
|
|
376
373
|
};
|
|
377
374
|
|
|
378
|
-
interface GridCellProps extends Pick<
|
|
379
|
-
CellRuntimeState,
|
|
380
|
-
"output" | "staleInputs"
|
|
381
|
-
> {
|
|
375
|
+
interface GridCellProps extends Pick<CellRuntimeState, "output"> {
|
|
382
376
|
className?: string;
|
|
383
377
|
code: string;
|
|
384
378
|
cellId: CellId;
|
|
@@ -392,7 +386,6 @@ interface GridCellProps extends Pick<
|
|
|
392
386
|
const GridCell = memo(
|
|
393
387
|
({
|
|
394
388
|
output,
|
|
395
|
-
staleInputs,
|
|
396
389
|
cellId,
|
|
397
390
|
mode,
|
|
398
391
|
code,
|
|
@@ -402,8 +395,9 @@ const GridCell = memo(
|
|
|
402
395
|
className,
|
|
403
396
|
}: GridCellProps) => {
|
|
404
397
|
const execution = useCellExecution(cellId);
|
|
398
|
+
const freshness = useCellFreshness(cellId);
|
|
405
399
|
const loading = outputIsLoading(execution.status);
|
|
406
|
-
const stale = outputIsStale(execution,
|
|
400
|
+
const stale = outputIsStale(execution, freshness, false);
|
|
407
401
|
const hidden =
|
|
408
402
|
hideWithoutValue &&
|
|
409
403
|
execution.outcome !== null &&
|
|
@@ -32,7 +32,11 @@ import { getReadonlyCodeDisplay } from "@/core/cells/readonly-code-display";
|
|
|
32
32
|
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
|
|
33
33
|
import { useResolvedMarimoConfig } from "@/core/config/config";
|
|
34
34
|
import { CSSClasses } from "@/core/constants";
|
|
35
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
runtimeStatusAtom,
|
|
37
|
+
useCellExecution,
|
|
38
|
+
useCellFreshness,
|
|
39
|
+
} from "@/core/executions";
|
|
36
40
|
import { useNotebookCodeAvailable } from "@/core/meta/code-visibility";
|
|
37
41
|
import { showCodeInRunModeAtom } from "@/core/meta/state";
|
|
38
42
|
import {
|
|
@@ -103,7 +107,6 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
|
|
|
103
107
|
cellOutputArea={userConfig.display.cell_output}
|
|
104
108
|
showCode={showCode && canShowCode}
|
|
105
109
|
mode={mode}
|
|
106
|
-
staleInputs={cell.staleInputs}
|
|
107
110
|
name={cell.name}
|
|
108
111
|
kiosk={kioskMode}
|
|
109
112
|
showErrorTracebacks={userConfig.runtime.show_tracebacks ?? false}
|
|
@@ -300,7 +303,7 @@ const ActionButtons: React.FC<{
|
|
|
300
303
|
|
|
301
304
|
interface VerticalCellProps extends Pick<
|
|
302
305
|
CellRuntimeState,
|
|
303
|
-
"output" | "consoleOutputs"
|
|
306
|
+
"output" | "consoleOutputs"
|
|
304
307
|
> {
|
|
305
308
|
cellOutputArea: "above" | "below";
|
|
306
309
|
cellId: CellId;
|
|
@@ -320,7 +323,6 @@ const VerticalCell = memo(
|
|
|
320
323
|
cellOutputArea,
|
|
321
324
|
cellId,
|
|
322
325
|
config,
|
|
323
|
-
staleInputs,
|
|
324
326
|
code,
|
|
325
327
|
showCode,
|
|
326
328
|
mode,
|
|
@@ -330,11 +332,12 @@ const VerticalCell = memo(
|
|
|
330
332
|
}: VerticalCellProps) => {
|
|
331
333
|
const cellRef = useRef<HTMLDivElement>(null);
|
|
332
334
|
const execution = useCellExecution(cellId);
|
|
335
|
+
const freshness = useCellFreshness(cellId);
|
|
333
336
|
const errored = execution.outcome === "error";
|
|
334
337
|
const interrupted = execution.outcome === "interrupted";
|
|
335
338
|
const stopped = execution.outcome === "skipped";
|
|
336
339
|
|
|
337
|
-
const outputStale = outputIsStale(execution,
|
|
340
|
+
const outputStale = outputIsStale(execution, freshness, false);
|
|
338
341
|
const loading = outputIsLoading(execution.status);
|
|
339
342
|
|
|
340
343
|
// Kiosk and not presenting
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useDeleteCellCallback } from "@/components/editor/cell/useDeleteCell";
|
|
4
4
|
import { outputIsStale } from "@/core/cells/cell";
|
|
5
|
-
import { useCellExecution } from "@/core/executions";
|
|
5
|
+
import { useCellExecution, useCellFreshness } from "@/core/executions";
|
|
6
6
|
import { useCellActions } from "@/core/cells/actions";
|
|
7
7
|
import type { CellId } from "@/core/cells/ids";
|
|
8
8
|
import { type CellColumnId, type Layout, useLayout } from "@/core/cells/layout";
|
|
@@ -629,6 +629,7 @@ const SlideThumbnailCard = ({
|
|
|
629
629
|
}: SlideThumbnailCardProps) => {
|
|
630
630
|
const { width, height, scale } = dimensions;
|
|
631
631
|
const execution = useCellExecution(cell.id);
|
|
632
|
+
const freshness = useCellFreshness(cell.id);
|
|
632
633
|
const visual = isNoOutput ? NO_OUTPUT_VISUAL : getSlideTypeVisual(slideType);
|
|
633
634
|
const isSkipped = isNoOutput || slideType === "skip";
|
|
634
635
|
|
|
@@ -679,7 +680,7 @@ const SlideThumbnailCard = ({
|
|
|
679
680
|
cellId={cell.id}
|
|
680
681
|
status={execution.status}
|
|
681
682
|
output={cell.output}
|
|
682
|
-
stale={outputIsStale(execution,
|
|
683
|
+
stale={outputIsStale(execution, freshness, false)}
|
|
683
684
|
/>
|
|
684
685
|
)}
|
|
685
686
|
</div>
|
|
@@ -20,7 +20,7 @@ import { Button } from "@/components/ui/button";
|
|
|
20
20
|
import { useFullScreenElement } from "@/components/ui/fullscreen";
|
|
21
21
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
22
22
|
import { outputIsStale } from "@/core/cells/cell";
|
|
23
|
-
import { useCellExecution } from "@/core/executions";
|
|
23
|
+
import { useCellExecution, useCellFreshness } from "@/core/executions";
|
|
24
24
|
import type { CellId } from "@/core/cells/ids";
|
|
25
25
|
import type { RuntimeCell } from "@/core/cells/types";
|
|
26
26
|
import type { RevealApi, RevealConfig } from "reveal.js";
|
|
@@ -354,13 +354,14 @@ function resolveSlideContentStyle(
|
|
|
354
354
|
*/
|
|
355
355
|
export const CellOutputBlock = ({ cell }: { cell: RuntimeCell }) => {
|
|
356
356
|
const execution = useCellExecution(cell.id);
|
|
357
|
+
const freshness = useCellFreshness(cell.id);
|
|
357
358
|
return (
|
|
358
359
|
<div className="flex flex-col" {...cellDomProps(cell.id, cell.name)}>
|
|
359
360
|
<CellOutputSlide
|
|
360
361
|
cellId={cell.id}
|
|
361
362
|
status={execution.status}
|
|
362
363
|
output={cell.output}
|
|
363
|
-
stale={outputIsStale(execution,
|
|
364
|
+
stale={outputIsStale(execution, freshness, false)}
|
|
364
365
|
/>
|
|
365
366
|
</div>
|
|
366
367
|
);
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "@/core/cells/utils";
|
|
24
24
|
import type { CellData, CellRuntimeState } from "@/core/cells/types";
|
|
25
25
|
import type { LanguageAdapterType } from "@/core/codemirror/language/types";
|
|
26
|
-
import { useCellExecution } from "@/core/executions";
|
|
26
|
+
import { useCellExecution, useCellFreshness } from "@/core/executions";
|
|
27
27
|
import { connectionAtom } from "@/core/network/connection";
|
|
28
28
|
import { useTheme } from "@/theme/useTheme";
|
|
29
29
|
import { cn } from "@/utils/cn";
|
|
@@ -64,6 +64,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
64
64
|
const cellOutputPosition = userConfig.display.cell_output;
|
|
65
65
|
const hasOutput = cell.output != null;
|
|
66
66
|
const execution = useCellExecution(cell.id);
|
|
67
|
+
const freshness = useCellFreshness(cell.id);
|
|
67
68
|
const errored = execution.outcome === "error";
|
|
68
69
|
const interrupted = execution.outcome === "interrupted";
|
|
69
70
|
const stopped = execution.outcome === "skipped";
|
|
@@ -71,9 +72,8 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
71
72
|
const uninstantiated = isUninstantiated(execution);
|
|
72
73
|
|
|
73
74
|
const needsRun = cellNeedsRun({
|
|
74
|
-
|
|
75
|
+
freshness,
|
|
75
76
|
interrupted,
|
|
76
|
-
staleInputs: cell.staleInputs,
|
|
77
77
|
disabled: cell.config.disabled,
|
|
78
78
|
blocked: execution.blocked,
|
|
79
79
|
});
|
|
@@ -96,7 +96,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
96
96
|
cellId={cell.id}
|
|
97
97
|
status={execution.status}
|
|
98
98
|
output={cell.output}
|
|
99
|
-
stale={outputIsStale(execution,
|
|
99
|
+
stale={outputIsStale(execution, freshness, false)}
|
|
100
100
|
/>
|
|
101
101
|
);
|
|
102
102
|
|
|
@@ -106,8 +106,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
106
106
|
editing={true}
|
|
107
107
|
status={execution.status}
|
|
108
108
|
disabled={cell.config.disabled ?? false}
|
|
109
|
-
|
|
110
|
-
edited={cell.edited}
|
|
109
|
+
freshness={freshness}
|
|
111
110
|
interrupted={interrupted}
|
|
112
111
|
elapsedTime={execution.duration}
|
|
113
112
|
startedAt={execution.startedAt}
|
|
@@ -123,7 +122,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
123
122
|
/>
|
|
124
123
|
<div className="flex items-center shadow-none gap-1">
|
|
125
124
|
<RunButton
|
|
126
|
-
edited={
|
|
125
|
+
edited={freshness.sourceChanged}
|
|
127
126
|
status={execution.status}
|
|
128
127
|
blocked={execution.blocked}
|
|
129
128
|
needsRun={needsRun}
|
|
@@ -192,6 +191,7 @@ export const SlideCellReadOnlyView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
192
191
|
const [userConfig] = useUserConfig();
|
|
193
192
|
const cellOutputPosition = userConfig.display.cell_output;
|
|
194
193
|
const execution = useCellExecution(cell.id);
|
|
194
|
+
const freshness = useCellFreshness(cell.id);
|
|
195
195
|
|
|
196
196
|
const display = useMemo(() => getReadonlyCodeDisplay(cell.code), [cell.code]);
|
|
197
197
|
|
|
@@ -200,7 +200,7 @@ export const SlideCellReadOnlyView = ({ cell }: { cell: RuntimeCell }) => {
|
|
|
200
200
|
cellId={cell.id}
|
|
201
201
|
status={execution.status}
|
|
202
202
|
output={cell.output}
|
|
203
|
-
stale={outputIsStale(execution,
|
|
203
|
+
stale={outputIsStale(execution, freshness, false)}
|
|
204
204
|
/>
|
|
205
205
|
);
|
|
206
206
|
|