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: temporarily visibility should not register notebook needs save (#2614)
Akshay Agrawal174bcd63f90a
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsxindex 3a4647f30c..1cfa769430 100644--- a/frontend/src/components/editor/Cell.tsx+++ b/frontend/src/components/editor/Cell.tsx@@ -9,6 +9,7 @@ import {useCallback,useImperativeHandle,useRef,+ useState,} from "react";import { saveCellConfig, sendRun, sendStdin } from "@/core/network/requests";@@ -175,6 +176,7 @@ const CellComponent = (const cellActionDropdownRef = useRef<CellActionsDropdownHandle>(null);const editorView = useRef<EditorView | null>(null);const setAiCompletionCell = useSetAtom(aiCompletionCellAtom);+ const [temporarilyVisible, setTemporarilyVisible] = useState(false);const disabledOrAncestorDisabled =cellConfig.disabled || status === "disabled-transitively";@@ -522,7 +524,8 @@ const CellComponent = (clearSerializedEditorState={clearSerializedEditorState}userConfig={userConfig}editorViewRef={editorView}- hidden={cellConfig.hide_code}+ hidden={cellConfig.hide_code && !temporarilyVisible}+ setTemporarilyVisible={setTemporarilyVisible}/><div className="shoulder-right z-20"><CellStatusComponentdiff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsxindex 6ac0fc2e00..4650335865 100644--- a/frontend/src/components/editor/cell/code/cell-editor.tsx+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx@@ -63,6 +63,10 @@ export interface CellEditorPropsallowFocus: boolean;userConfig: UserConfig;hidden?: boolean;+ /**+ * Not used by scratchpad.+ */+ setTemporarilyVisible?: (value: boolean) => void;}const CellEditorInternal = ({@@ -85,6 +89,7 @@ const CellEditorInternal = ({userConfig,editorViewRef,hidden,+ setTemporarilyVisible,}: CellEditorProps) => {const [aiCompletionCell, setAiCompletionCell] = useAtom(aiCompletionCellAtom);const [languageAdapter, setLanguageAdapter] = useState<LanguageAdapterType>();@@ -325,9 +330,9 @@ const CellEditorInternal = ({};}, [editorViewRef]);- const temporarilyShowCode = async () => {- if (hidden) {- updateCellConfig({ cellId, config: { hide_code: false } });+ const temporarilyShowCode = useCallback(async () => {+ if (hidden && setTemporarilyVisible !== undefined) {+ setTemporarilyVisible(true);editorViewRef.current?.focus();// Reach one parent upconst parent = editorViewParentRef.current?.parentElement;@@ -342,7 +347,7 @@ const CellEditorInternal = ({return;}// Hide the code editor- updateCellConfig({ cellId, config: { hide_code: true } });+ setTemporarilyVisible(false);editorViewRef.current?.dom.blur();abortController.abort();});@@ -350,7 +355,7 @@ const CellEditorInternal = ({{ signal: abortController.signal },);}- };+ }, [hidden, setTemporarilyVisible, editorViewRef, editorViewParentRef]);return (<AiCompletionEditor