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 mo.ui.dataframe showing incorrect column count (#7845)

Anirudh Dagarf71f75908731
diff --git a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
index d36052b5f6..ee1b0a1acc 100644
--- a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
+++ b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
@@ -202,6 +202,8 @@ export const DataFrameComponent = memo(
sql_code,
} = data || {};
+ const totalColumns = field_types?.length;
+
const [internalValue, setInternalValue] = useState<Transformations>(
value || EMPTY,
);
@@ -317,7 +319,7 @@ export const DataFrameComponent = memo(
data={url || ""}
hasStableRowId={false}
totalRows={total_rows ?? 0}
- totalColumns={Object.keys(columns).length}
+ totalColumns={totalColumns ?? 0}
maxColumns="all"
pageSize={pageSize}
pagination={true}