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: start charts tab open if any configured for table (#4882)
Myles Scolnickf0d258e8e085
diff --git a/frontend/src/components/data-table/charts/storage.ts b/frontend/src/components/data-table/charts/storage.tsindex f3fb56f0ac..016f87bc01 100644--- a/frontend/src/components/data-table/charts/storage.ts+++ b/frontend/src/components/data-table/charts/storage.ts@@ -74,3 +74,15 @@ export function getChartTabName(tabNum: number, chartType: ChartType) {}return `${capitalizedChartType} Chart ${tabNum + 1}` as TabName;}++const initialStorageValue = mapStorage.getItem(KEY);+/**+ * Returns true if the cell has a chart+ */+export function hasChart(cellId: CellId) {+ const tabs = initialStorageValue.get(cellId);+ if (!tabs) {+ return false;+ }+ return tabs.length > 0;+}diff --git a/frontend/src/plugins/impl/DataTablePlugin.tsx b/frontend/src/plugins/impl/DataTablePlugin.tsxindex 5c96179489..82a0d814a8 100644--- a/frontend/src/plugins/impl/DataTablePlugin.tsx+++ b/frontend/src/plugins/impl/DataTablePlugin.tsx@@ -60,6 +60,7 @@ import { usePanelOwnership } from "@/components/data-table/row-viewer-panel/use-import { Provider } from "jotai";import { store } from "@/core/state/jotai";import { loadTableData } from "@/components/data-table/utils";+import { hasChart } from "@/components/data-table/charts/storage";type CsvURL = string;export type TableData<T> = T[] | CsvURL;@@ -344,6 +345,8 @@ export const LoadingDataTableComponent = memo(<T extends {}>(props: Omit<DataTableProps<T>, "sorting"> & { data: TableData<T> },) => {+ const cellId = findCellId(props.host);+const search = props.search;const setValue = props.setValue;// Sorting/searching state@@ -355,7 +358,13 @@ export const LoadingDataTableComponent = memo(});const [searchQuery, setSearchQuery] = useState<string>("");const [filters, setFilters] = useState<ColumnFiltersState>([]);- const [displayHeader, setDisplayHeader] = useState(false);+ const [displayHeader, setDisplayHeader] = useState(() => {+ // Show the header if a single chart is configured+ if (!getFeatureFlag("table_charts") || !cellId) {+ return false;+ }+ return hasChart(cellId);+ });// We need to clear the selection when sort, query, or filters change// if we don't have a stable ID for each row, which is determined by@@ -376,8 +385,6 @@ export const LoadingDataTableComponent = memo(}}, [props.pageSize, paginationState.pageSize]);- const cellId = findCellId(props.host);-// Data loadingconst { data, loading, error } = useAsyncData<{rows: T[];