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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: remove autoscroll (#5344)
Myles Scolnickc29afca600ce
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsxindex 66b8b3ea03..2a3e62e12a 100644--- a/frontend/src/components/editor/Cell.tsx+++ b/frontend/src/components/editor/Cell.tsx@@ -380,11 +380,6 @@ export interface CellProps* False only when there is only one cell in the notebook.*/canDelete: boolean;- /**- * If true, the cell is allowed to be focus on.- * This is false when the app is initially loading.- */- allowFocus: boolean;userConfig: UserConfig;/*** If true, the cell is allowed to be moved left and right.@@ -539,7 +534,6 @@ ReadonlyCellComponent.displayName = "ReadonlyCellComponent";const EditableCellComponent = ({theme,showPlaceholder,- allowFocus,id: cellId,code,output,@@ -816,7 +810,6 @@ const EditableCellComponent = ({<CellEditortheme={theme}showPlaceholder={showPlaceholder}- allowFocus={allowFocus}id={cellId}code={code}config={cellConfig}@@ -1118,7 +1111,6 @@ const CellToolbar = ({const SetupCellComponent = ({theme,showPlaceholder,- allowFocus,id: cellId,code,output,@@ -1287,7 +1279,6 @@ const SetupCellComponent = ({<CellEditortheme={theme}showPlaceholder={showPlaceholder}- allowFocus={allowFocus}id={cellId}code={code}config={cellConfig}diff --git a/frontend/src/components/editor/__tests__/data-attributes.test.tsx b/frontend/src/components/editor/__tests__/data-attributes.test.tsxindex 055d3a2b04..f1a5362492 100644--- a/frontend/src/components/editor/__tests__/data-attributes.test.tsx+++ b/frontend/src/components/editor/__tests__/data-attributes.test.tsx@@ -107,7 +107,6 @@ describe("Cell data attributes", () => {canMoveX={false}theme="light"showPlaceholder={false}- allowFocus={true}/></TooltipProvider>,);diff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsxindex 51630e6215..94b9f7cb2d 100644--- a/frontend/src/components/editor/cell/code/cell-editor.tsx+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx@@ -9,7 +9,7 @@ import { Button } from "@/components/ui/button";import { DelayMount } from "@/components/utils/delay-mount";import { aiCompletionCellAtom } from "@/core/ai/state";import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";-import { notebookAtom, useCellActions } from "@/core/cells/cells";+import { useCellActions } from "@/core/cells/cells";import { useSetLastFocusedCellId } from "@/core/cells/focus";import type { CellData, CellRuntimeState } from "@/core/cells/types";import { setupCodeMirror } from "@/core/codemirror/cm";@@ -31,7 +31,6 @@ import { connectionAtom } from "@/core/network/connection";import { saveCellConfig } from "@/core/network/requests";import { isRtcEnabled } from "@/core/rtc/state";import { useSaveNotebook } from "@/core/saving/save-component";-import { store } from "@/core/state/jotai";import { WebSocketState } from "@/core/websocket/types";import type { Theme } from "@/theme/useTheme";import { cn } from "@/utils/cn";@@ -51,11 +50,6 @@ export interface CellEditorPropsshowPlaceholder: boolean;editorViewRef: React.MutableRefObject<EditorView | null>;setEditorView: (view: EditorView) => void;- /**- * If true, the cell is allowed to be focus on.- * This is false when the app is initially loading.- */- allowFocus: boolean;userConfig: UserConfig;/*** If true, the cell code is hidden.@@ -77,7 +71,6 @@ export interface CellEditorPropsconst CellEditorInternal = ({theme,showPlaceholder,- allowFocus,id: cellId,config: cellConfig,code,@@ -363,31 +356,6 @@ const CellEditorInternal = ({extensions,]);- // Auto-focus. Should focus newly created editors.- // We don't focus if RTC is enabled, since other players will be creating editors- const shouldFocus =- (editorViewRef.current === null || serializedEditorState !== null) &&- !isRtcEnabled();- useEffect(() => {- // Perf:- // We don't pass this in from the props since it causes lots of re-renders for unrelated cells- const hasNotebookKey = store.get(notebookAtom).scrollKey !== null;-- // Only focus if the notebook does not currently have a scrollKey (which means we are focusing on another cell)- if (shouldFocus && allowFocus && !hasNotebookKey) {- // Focus and scroll into view; request an animation frame to- // avoid a race condition when new editors are created- // very rapidly by holding a hotkey- requestAnimationFrame(() => {- editorViewRef.current?.focus();- editorViewRef.current?.dom.scrollIntoView({- behavior: "smooth",- block: "nearest",- });- });- }- }, [shouldFocus, allowFocus, editorViewRef]);-// Destroy the editor when the component is unmounteduseEffect(() => {const ev = editorViewRef.current;diff --git a/frontend/src/components/editor/renderers/CellArray.tsx b/frontend/src/components/editor/renderers/CellArray.tsxindex b2329e18c8..264b374709 100644--- a/frontend/src/components/editor/renderers/CellArray.tsx+++ b/frontend/src/components/editor/renderers/CellArray.tsx@@ -226,7 +226,6 @@ const CellColumn: React.FC<{key={SETUP_CELL_ID}theme={theme}showPlaceholder={false}- allowFocus={!invisible}{...notebook.cellData[SETUP_CELL_ID]}{...notebook.cellRuntime[SETUP_CELL_ID]}{...actions}@@ -261,7 +260,6 @@ const CellColumn: React.FC<{key={cellData.id.toString()}theme={theme}showPlaceholder={hasOnlyOneCell}- allowFocus={!invisible}{...cellData}{...cellRuntime}runElapsedTimeMs={diff --git a/frontend/src/components/scratchpad/scratchpad.tsx b/frontend/src/components/scratchpad/scratchpad.tsxindex b258d4fe8b..1b3f0ec39c 100644--- a/frontend/src/components/scratchpad/scratchpad.tsx+++ b/frontend/src/components/scratchpad/scratchpad.tsx@@ -130,7 +130,6 @@ export const ScratchPad: React.FC = () => {<div className="overflow-auto flex-shrink-0 max-h-[40%]"><CellEditortheme={theme}- allowFocus={false}showPlaceholder={false}id={cellId}code={code}diff --git a/frontend/src/stories/cell.stories.tsx b/frontend/src/stories/cell.stories.tsxindex 338c3a8462..d7fe02391b 100644--- a/frontend/src/stories/cell.stories.tsx+++ b/frontend/src/stories/cell.stories.tsx@@ -38,7 +38,6 @@ const props: CellProps = {name: "cell_1",connectionState: WebSocketState.OPEN,canDelete: true,- allowFocus: false,debuggerActive: false,isCollapsed: false,collapseCount: 0,