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: expand hidden code on go-to-definition (#5803)
Myles Scolnickff1b059a7e11
diff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsxindex c7316f707a..d693d40dba 100644--- a/frontend/src/components/editor/cell/code/cell-editor.tsx+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx@@ -49,7 +49,7 @@ export interface CellEditorPropsrunCell: () => void;theme: Theme;showPlaceholder: boolean;- editorViewRef: React.MutableRefObject<EditorView | null>;+ editorViewRef: React.RefObject<EditorView | null>;setEditorView: (view: EditorView) => void;userConfig: UserConfig;/**@@ -65,7 +65,7 @@ export interface CellEditorProps>;// Props below are not used by scratchpad.// DOM node where the editorView will be mounted- editorViewParentRef?: React.MutableRefObject<HTMLDivElement | null>;+ editorViewParentRef?: React.RefObject<HTMLDivElement | null>;showHiddenCode: (opts?: { focus?: boolean }) => void;}@@ -217,6 +217,12 @@ const CellEditorInternal = ({}}}),+ // Whenever the editor is focused (e.g. via go-to-definition), show the cell if it is hidden.+ EditorView.domEventHandlers({+ focus: () => {+ showHiddenCode({ focus: false });+ },+ }),);return extensions;diff --git a/frontend/src/utils/mergeRefs.ts b/frontend/src/utils/mergeRefs.tsindex 2c6c08fd06..115e0923d6 100644--- a/frontend/src/utils/mergeRefs.ts+++ b/frontend/src/utils/mergeRefs.ts@@ -7,7 +7,7 @@ export function mergeRefs<T>(if (typeof ref === "function") {ref(value);} else if (ref != null) {- (ref as React.MutableRefObject<T | null>).current = value;+ ref.current = value;}});};