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: save button in multi-col notebooks lighting up (#5691)

Shahmir Varqha85cfa0c79469
diff --git a/frontend/src/core/cells/__tests__/utils.test.ts b/frontend/src/core/cells/__tests__/utils.test.ts
index b9e7926495..9dddc83eff 100644
--- a/frontend/src/core/cells/__tests__/utils.test.ts
+++ b/frontend/src/core/cells/__tests__/utils.test.ts
@@ -58,9 +58,9 @@ describe("getCellConfigs", () => {
// Assert the results
expect(result).toEqual([
{ hide_code: false, disabled: false, column: 0 },
- { hide_code: true, disabled: false },
+ { hide_code: true, disabled: false, column: null },
{ hide_code: false, disabled: true, column: 1 },
- { hide_code: true, disabled: true },
+ { hide_code: true, disabled: true, column: null },
]);
// Check that the original state was not modified
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index ecc4ef4b17..751f868796 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -1416,6 +1416,9 @@ function updateCellData({
export function getCellConfigs(state: NotebookState): CellConfig[] {
const cells = state.cellData;
+ // We set to null by default to prevent inconsistencies between undefined & null
+ const defaultCellConfig: Partial<CellConfig> = { column: null };
+
// Handle the case where there's only one column
// We don't want to set the column config
const hasMultipleColumns = state.cellIds.getColumns().length > 1;
@@ -1424,7 +1427,7 @@ export function getCellConfigs(state: NotebookState): CellConfig[] {
return column.inOrderIds.map((cellId) => {
return {
...cells[cellId].config,
- column: null,
+ ...defaultCellConfig,
};
});
});
@@ -1432,7 +1435,7 @@ export function getCellConfigs(state: NotebookState): CellConfig[] {
return state.cellIds.getColumns().flatMap((column, columnIndex) => {
return column.inOrderIds.map((cellId, cellIndex) => {
- const config: Partial<CellConfig> = { column: undefined };
+ const config: Partial<CellConfig> = { ...defaultCellConfig };
// Only set the column index for the first cell in the column
if (cellIndex === 0) {