:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
refactor(frontend): remove defunct tabId from the DataTable tree (#62006)
Paul D'Ambra926c3ef6abd6
diff --git a/frontend/src/lib/logic/tabUiStateLogic.test.ts b/frontend/src/lib/logic/tabUiStateLogic.test.tsindex 9f7d8197b611..7e908adc841b 100644--- a/frontend/src/lib/logic/tabUiStateLogic.test.ts+++ b/frontend/src/lib/logic/tabUiStateLogic.test.ts@@ -118,8 +118,8 @@ describe('tabUiStateLogic', () => {logicB.unmount()// State survives both unmounts — the global owns it.- expect(tabUiStateLogic.values.expandedRowsFor(TAB_A, `viz-${TAB_A}`)).toEqual([1])- expect(tabUiStateLogic.values.expandedRowsFor(TAB_B, `viz-${TAB_B}`)).toEqual([2])+ expect(tabUiStateLogic.values.expandedRowsFor(undefined, `viz-${TAB_A}`)).toEqual([1])+ expect(tabUiStateLogic.values.expandedRowsFor(undefined, `viz-${TAB_B}`)).toEqual([2])})describe('savedQueriesByTabAndScene', () => {diff --git a/frontend/src/queries/Query/Query.tsx b/frontend/src/queries/Query/Query.tsxindex 2d9ae9d7e454..f6e953699f63 100644--- a/frontend/src/queries/Query/Query.tsx+++ b/frontend/src/queries/Query/Query.tsx@@ -87,8 +87,6 @@ export interface QueryProps<Q extends Node> {dataAttr?: string/** Attach ourselves to another logic, such as the scene logic */attachTo?: BuiltLogic | LogicWrapper- /** Owning internal tab; used to scope per-tab UI state across tab unmounts */- tabId?: string}export function Query<Q extends Node>(props: QueryProps<Q>): JSX.Element | null {@@ -144,7 +142,6 @@ export function Query<Q extends Node>(props: QueryProps<Q>): JSX.Element | nulluniqueKey={uniqueKey}readOnly={readOnly}dataAttr={dataAttr}- tabId={props.tabId}/>)} else if (isDataVisualizationNode(query)) {diff --git a/frontend/src/queries/nodes/DataTable/DataTable.tsx b/frontend/src/queries/nodes/DataTable/DataTable.tsxindex 9e2919302f5f..56ffcbd3f627 100644--- a/frontend/src/queries/nodes/DataTable/DataTable.tsx+++ b/frontend/src/queries/nodes/DataTable/DataTable.tsx@@ -125,8 +125,6 @@ interface DataTableProps {dataAttr?: string/** Attach ourselves to another logic, such as the scene logic */attachTo?: BuiltLogic | LogicWrapper- /** Owning internal tab; used to scope per-tab UI state across tab unmounts */- tabId?: string}const eventGroupTypes = [@@ -148,7 +146,6 @@ export function DataTable({readOnly,dataAttr,attachTo,- tabId,}: DataTableProps): JSX.Element {const [uniqueNodeKey] = useState(() => uniqueNode++)const [dataKey] = useState(() => `DataNode.${uniqueKey || uniqueNodeKey}`)@@ -205,7 +202,6 @@ export function DataTable({dataKey,dataNodeLogicKey: dataNodeLogicProps.key,context,- tabId,}const {dataTableRows,@@ -948,14 +944,9 @@ export function DataTable({? context.expandable: expandable && columnsInResponse?.includes('*')? {- ...(tabId !== undefined- ? {- isRowExpanded: (_, rowIndex) =>- expandedRows.includes(rowIndex),- onRowExpand: (_, rowIndex) => toggleRowExpanded(rowIndex),- onRowCollapse: (_, rowIndex) => toggleRowExpanded(rowIndex),- }- : {}),+ isRowExpanded: (_, rowIndex) => expandedRows.includes(rowIndex),+ onRowExpand: (_, rowIndex) => toggleRowExpanded(rowIndex),+ onRowCollapse: (_, rowIndex) => toggleRowExpanded(rowIndex),expandedRowRender: function renderExpand({ result }) {if ((isEventsQuery(query.source) ||diff --git a/frontend/src/queries/nodes/DataTable/dataTableLogic.ts b/frontend/src/queries/nodes/DataTable/dataTableLogic.tsindex 9a3e06bad9b7..1c9880d9b1c7 100644--- a/frontend/src/queries/nodes/DataTable/dataTableLogic.ts+++ b/frontend/src/queries/nodes/DataTable/dataTableLogic.ts@@ -32,8 +32,6 @@ export interface DataTableLogicProps {context?: QueryContext<DataTableNode>// Override the data logic node key if neededdataNodeLogicKey?: string- // Used to scope per-tab UI state (e.g. expanded rows) so it survives tab switches- tabId?: string}export interface DataTableRow {@@ -88,21 +86,15 @@ export const dataTableLogic = kea<dataTableLogicType>([})),listeners(({ props, actions }) => ({toggleRowExpanded: ({ rowIndex }) => {- if (props.tabId === undefined) {- return- }- actions.toggleExpandedRow(props.tabId, props.vizKey, rowIndex)+ actions.toggleExpandedRow(undefined, props.vizKey, rowIndex)},})),selectors({context: [() => [(_, props) => props.context], (context) => context],expandedRows: [- (s) => [s.expandedRowsFor, (_, p) => p.tabId, (_, p) => p.vizKey],- (- expandedRowsFor: (tabId: string | undefined, vizKey: string) => number[],- tabId: string | undefined,- vizKey: string- ): number[] => expandedRowsFor(tabId, vizKey),+ (s) => [s.expandedRowsFor, (_, p) => p.vizKey],+ (expandedRowsFor: (tabId: string | undefined, vizKey: string) => number[], vizKey: string): number[] =>+ expandedRowsFor(undefined, vizKey),{ resultEqualityCheck: objectsEqual },],sourceKind: [(_, p) => [p.query], (query): NodeKind | null => query.source?.kind],