Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

improvement: click hourglass to move view to current cell (#1040)

fuenfundachtzigac33436d5f3e
diff --git a/frontend/src/core/App.tsx b/frontend/src/core/App.tsx
index b3350e39a9..536bd6cf40 100644
--- a/frontend/src/core/App.tsx
+++ b/frontend/src/core/App.tsx
@@ -22,6 +22,7 @@ import {
notebookIsRunning,
notebookNeedsRun,
notebookNeedsSave,
+ notebookScrollToRunning,
useCellActions,
useNotebook,
} from "./cells/cells";
@@ -397,6 +398,7 @@ const RunningIcon = () => (
className={topLeftStatus}
data-testid="loading-indicator"
title={"Marimo is busy computing. Hang tight!"}
+ onClick={notebookScrollToRunning}
>
<HourglassIcon className="running-app-icon" size={30} strokeWidth={1} />
</div>
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index 649c52a35e..8ceca9481d 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -733,6 +733,22 @@ export function notebookIsRunning(state: NotebookState) {
);
}
+export function notebookScrollToRunning() {
+ // find cell that is currently in "running" state
+ const { cellRuntime } = store.get(notebookAtom);
+ const cell = Objects.entries(cellRuntime).find(
+ ([cellid, runtimestate]) => runtimestate.status === "running",
+ );
+ if (!cell) {
+ return;
+ }
+ const view = getCellEditorView(cell[0]);
+ view?.dispatch({
+ selection: { anchor: 0 },
+ effects: [EditorView.scrollIntoView(0, { y: "center" })],
+ });
+}
+
export function notebookNeedsSave(
state: NotebookState,
layout: LayoutState,