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.

fix: undefined errors that may crop up before kernel is fully instantiated (#5313)

Dylan Madisetti49b249998a40
diff --git a/frontend/src/components/editor/cell/useRunCells.ts b/frontend/src/components/editor/cell/useRunCells.ts
index 58483c1e22..bc6d597555 100644
--- a/frontend/src/components/editor/cell/useRunCells.ts
+++ b/frontend/src/components/editor/cell/useRunCells.ts
@@ -55,7 +55,7 @@ function useRunCells() {
const codes: string[] = [];
for (const cellId of cellIds) {
const ref = cellHandles[cellId];
- const ev = ref.current?.editorView;
+ const ev = ref?.current?.editorView;
let code: string;
// Performs side-effects that must run whenever the cell is run, but doesn't
// actually run the cell.
@@ -68,7 +68,7 @@ function useRunCells() {
// Prefer code from editor
code = getEditorCodeAsPython(ev);
} else {
- code = cellData[cellId].code;
+ code = cellData[cellId]?.code || "";
}
codes.push(code);