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: hide table explorers in vscode (#7206)

Myles Scolnickc60e6cd4a0ed
diff --git a/frontend/src/components/data-table/TableActions.tsx b/frontend/src/components/data-table/TableActions.tsx
index 9ddd19dadc..6bd83c6379 100644
--- a/frontend/src/components/data-table/TableActions.tsx
+++ b/frontend/src/components/data-table/TableActions.tsx
@@ -34,6 +34,7 @@ interface TableActionsProps<TData> {
toggleDisplayHeader?: () => void;
showChartBuilder?: boolean;
showColumnExplorer?: boolean;
+ showRowExplorer?: boolean;
showPageSizeSelector?: boolean;
togglePanel?: (panelType: PanelType) => void;
isPanelOpen?: (panelType: PanelType) => boolean;
@@ -55,6 +56,7 @@ export const TableActions = <TData,>({
toggleDisplayHeader,
showChartBuilder,
showColumnExplorer,
+ showRowExplorer,
showPageSizeSelector,
togglePanel,
isPanelOpen,
@@ -132,20 +134,22 @@ export const TableActions = <TData,>({
)}
{togglePanel && isPanelOpen !== undefined && (
<>
- <Tooltip content="Toggle row viewer">
- <Button
- variant="text"
- size="xs"
- onClick={() => togglePanel("row-viewer")}
- >
- <PanelRightIcon
- className={cn(
- "w-4 h-4 text-muted-foreground",
- isPanelOpen("row-viewer") && "text-primary",
- )}
- />
- </Button>
- </Tooltip>
+ {showRowExplorer && (
+ <Tooltip content="Toggle row viewer">
+ <Button
+ variant="text"
+ size="xs"
+ onClick={() => togglePanel("row-viewer")}
+ >
+ <PanelRightIcon
+ className={cn(
+ "w-4 h-4 text-muted-foreground",
+ isPanelOpen("row-viewer") && "text-primary",
+ )}
+ />
+ </Button>
+ </Tooltip>
+ )}
{showColumnExplorer && (
<Tooltip content="Toggle column explorer">
<Button
diff --git a/frontend/src/components/data-table/data-table.tsx b/frontend/src/components/data-table/data-table.tsx
index 601c25fdfa..1d6130b835 100644
--- a/frontend/src/components/data-table/data-table.tsx
+++ b/frontend/src/components/data-table/data-table.tsx
@@ -91,6 +91,7 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {
showChartBuilder?: boolean;
showPageSizeSelector?: boolean;
showColumnExplorer?: boolean;
+ showRowExplorer?: boolean;
togglePanel?: (panelType: PanelType) => void;
isPanelOpen?: (panelType: PanelType) => boolean;
}
@@ -133,6 +134,7 @@ const DataTableInternal = <TData,>({
showChartBuilder,
showPageSizeSelector,
showColumnExplorer,
+ showRowExplorer,
togglePanel,
isPanelOpen,
viewedRowIdx,
@@ -337,6 +339,7 @@ const DataTableInternal = <TData,>({
showChartBuilder={showChartBuilder}
showPageSizeSelector={showPageSizeSelector}
showColumnExplorer={showColumnExplorer}
+ showRowExplorer={showRowExplorer}
togglePanel={togglePanel}
isPanelOpen={isPanelOpen}
tableLoading={reloading}
diff --git a/frontend/src/plugins/impl/DataTablePlugin.tsx b/frontend/src/plugins/impl/DataTablePlugin.tsx
index 3216c521bb..3e8c5d9b4e 100644
--- a/frontend/src/plugins/impl/DataTablePlugin.tsx
+++ b/frontend/src/plugins/impl/DataTablePlugin.tsx
@@ -63,6 +63,7 @@ import { type CellId, findCellId } from "@/core/cells/ids";
import { slotsController } from "@/core/slots/slots";
import { store } from "@/core/state/jotai";
import { isStaticNotebook } from "@/core/static/static-state";
+import { isInVscodeExtension } from "@/core/vscode/is-in-vscode";
import { useAsyncData } from "@/hooks/useAsyncData";
import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
import { useEffectSkipFirstRender } from "@/hooks/useEffectSkipFirstRender";
@@ -179,6 +180,7 @@ interface Data<T> {
showDataTypes: boolean;
showPageSizeSelector: boolean;
showColumnExplorer: boolean;
+ showRowExplorer: boolean;
showChartBuilder: boolean;
rowHeaders: FieldTypesWithExternalType;
fieldTypes?: FieldTypesWithExternalType | null;
@@ -250,6 +252,7 @@ export const DataTablePlugin = createPlugin<S>("marimo-table")
showDataTypes: z.boolean().default(true),
showPageSizeSelector: z.boolean().default(true),
showColumnExplorer: z.boolean().default(true),
+ showRowExplorer: z.boolean().default(true),
showChartBuilder: z.boolean().default(true),
rowHeaders: columnToFieldTypesSchema,
freezeColumnsLeft: z.array(z.string()).optional(),
@@ -718,6 +721,7 @@ const DataTableComponent = ({
showDownload,
showPageSizeSelector,
showColumnExplorer,
+ showRowExplorer,
showChartBuilder,
showDataTypes,
rowHeaders,
@@ -899,6 +903,8 @@ const DataTableComponent = ({
const showColExplorer =
showColumnExplorer && preview_column && isPanelOpen("column-explorer");
+ const isInVscode = isInVscodeExtension();
+
return (
<>
{/* When the totalRows is "too_many" and the pageSize is the same as the
@@ -988,7 +994,10 @@ const DataTableComponent = ({
toggleDisplayHeader={toggleDisplayHeader}
showChartBuilder={showChartBuilder}
showPageSizeSelector={showPageSizeSelector}
- showColumnExplorer={showColumnExplorer}
+ // Hidden in VSCode (for now) because we don't have a panel to show
+ // the column/row explorer.
+ showColumnExplorer={showColumnExplorer && !isInVscode}
+ showRowExplorer={showRowExplorer && !isInVscode}
togglePanel={togglePanel}
isPanelOpen={isPanelOpen}
viewedRowIdx={viewedRowIdx}
diff --git a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
index b1767f3e7c..8394d9633a 100644
--- a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
+++ b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
@@ -297,6 +297,7 @@ export const DataFrameComponent = memo(
get_column_summaries={getColumnSummaries}
showPageSizeSelector={(total_rows && total_rows > 5) || false}
showColumnExplorer={false}
+ showRowExplorer={true}
showChartBuilder={false}
value={Arrays.EMPTY}
setValue={Functions.NOOP}