: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
fix(bi): improve worksheet exploration and source previews (#120111)
Marius Andra400297a9a99b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 11af65a700c5..103c01485a3a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6811,9 +6811,9 @@ snapshots:products-business-intelligence-worksheet-exploration--sql-preview--light:hash: v1.k794b7964.a694a2e34e9c18f6c4c50e3b930558dfd97dd59874df8e104fff77957a14fa06.WiYn-ILI2MLWRei6QPwwv-a_mBBFKFQpDdtAwCBcHaEproducts-business-intelligence-worksheets--worksheets--dark:- hash: v1.k794b7964.415c9082cf92256a775c1f21b314625a10282c76e91ed9373560c7e983aafde4.syfMPTOr1J9lrSDz6M0HWZn25hDTtND6yg9pQ9tP6Ww+ hash: v1.k794b7964.edb41b692932eca6f21366993f55d43ac3cd6628ffe267cf1ad008b53bbb8843.VSge8V3R4tiEjRliX4E7EFcPZ6PbvFQEU0aEsXueLyYproducts-business-intelligence-worksheets--worksheets--light:- hash: v1.k794b7964.6ff56d29db46966fd344a3779d4656ce2812ef8bd71ffb53572461ebb919dea3.EErtoA0a22PSvSEuEfN_2Q-Nlb2bwx6Lt3ovNC9NTSw+ hash: v1.k794b7964.24d175e135a878f06cbae273a95e81a24f64eba1916eb1bc4d88e4c3b41a340e.cONyC7fWEmnOlX8nLKeApe36zZIB0HdnHh-_PTG00ogproducts-dashboards--dashboard-states--dark:hash: v1.k794b7964.cc591635f83447f7bcfb802062302b8b1bbcd51826110b12fa0f68d4830dcfd3.CIgt_KxCyQRgbn7DPF4MDXc5JBlSxbaCPS0Snyx3cRsproducts-dashboards--dashboard-states--light:@@ -10263,9 +10263,9 @@ snapshots:scenes-app-data-warehouse-sql-editor--bi-calculated-measure-editor--light:hash: v1.k794b7964.69c71d482b1b19aa18a81b5ba0fc0bb038d8f3bdc9bdb0a7286c9addb4893dc2.LjgKhmcTELX-Cd50ZnnKmKLTGxv3AH0cD5BfLrBKfQ8scenes-app-data-warehouse-sql-editor--bi-catalog-snapshot--dark:- hash: v1.k794b7964.72fe89e09caa08343acb8f293445fa34d8aab42ffa4d66b1386551d239ab1108.ww2CgbguWaZTWgUH_9sSwcENmYScEBe4-7UcYnYmKRk+ hash: v1.k794b7964.10181063f3827891d0805f30255cdea9016bd9719e548b1ddbfa9333c79ff677.hkULoQ4TwGAnGsc2m6CXFTzhI_6TfuF2bBpKJXEIP0Escenes-app-data-warehouse-sql-editor--bi-catalog-snapshot--light:- hash: v1.k794b7964.576484bfd9cb020ba4ecdb91c39a863106414c667414f25da3b81955d768ac3a.8VZRtUu8AQomTvaOT-4N81ZDtUhBPOK7ePXzuzJup30+ hash: v1.k794b7964.3370c5777a860307cb7bd0a13c902b1610f9c38065b64fadbfe185349cd9ec81.1PpQrK62SuqteGgeX4sXzL09NY-yAjHumWFFfLzpx7kscenes-app-data-warehouse-sql-editor--bi-catalog-source--dark:hash: v1.k794b7964.7f7a8be7f10226665eaef97b037b9f5ba1025186e5820fd53a6e012e1f80a2e8.rTSemg-6VGHCgB7ykDZp81WmDqzNBgzalDpTlQ24BrIscenes-app-data-warehouse-sql-editor--bi-catalog-source--light:@@ -10334,6 +10334,10 @@ snapshots:hash: v1.k794b7964.06df092616d217a4ebdaf0f5f35015c05fe63f5bc1e9b9c39dcdf6594293c0e3.D8zEjaefT5868HRYC8F6GkfsuMMlcxSxekM5z-VoXyMscenes-app-data-warehouse-sql-editor--bi-saved-insight--light:hash: v1.k794b7964.2c5f15b06d4347f767fc34bf934ea1bd53e988c443d528edb457795e778cc556.FcMHWv530RuOEcqg3G_bnos4zzZ4mku3Q9pdsK-VCXU+ scenes-app-data-warehouse-sql-editor--bi-source-preview-large-sample--dark:+ hash: v1.k794b7964.5be150e822bb692b47b8f7d04846613a6a5d43759c289c35076fb5773481cac6.wsA7jkLolGQWEQjQP8D3xOjPCCpFbu0sdJvUwEfIrOw+ scenes-app-data-warehouse-sql-editor--bi-source-preview-large-sample--light:+ hash: v1.k794b7964.f9bdafe72c33b8454fe4d48e70433457801d2d198e398a25d58ff3926f4f29ab.VcdI3e-Cydfw21sTHkEAiZdXPeRVvBT6TBGUZbP5lTcscenes-app-data-warehouse-sql-editor--bi-table-analysis--dark:hash: v1.k794b7964.29a6892f69408e75d2bcdae29d497728fde99162145970d71f8eb360c496e3f0.o9tf11AX8PLroocZlorxrzHmh47URcAZrYIxqcH7kKoscenes-app-data-warehouse-sql-editor--bi-table-analysis--light:diff --git a/frontend/src/lib/lemon-ui/LemonTable/LemonTable.test.tsx b/frontend/src/lib/lemon-ui/LemonTable/LemonTable.test.tsxindex b2d2a246d993..8101cb9e672e 100644--- a/frontend/src/lib/lemon-ui/LemonTable/LemonTable.test.tsx+++ b/frontend/src/lib/lemon-ui/LemonTable/LemonTable.test.tsx@@ -37,6 +37,42 @@ describe('LemonTable', () => {const renderedOrder = (): string[] => screen.getAllByTestId('cell-name').map((el) => el.textContent ?? '')+ it('does not rerender retained virtualized cells when scrolling', () => {+ const height = jest+ .spyOn(HTMLElement.prototype, 'offsetHeight', 'get')+ .mockImplementation(function (this: HTMLElement): number {+ return this.tagName === 'TR' ? 36 : 180+ })+ const width = jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(800)+ const renderCell = jest.fn((value: string | number | undefined): string => String(value))+ const data = Array.from({ length: 100 }, (_, id) => ({ id, name: `Row ${id}` }))++ try {+ const { container } = render(+ <LemonTable+ rowKey="id"+ dataSource={data}+ columns={[{ title: 'Name', dataIndex: 'name', render: renderCell }]}+ allowContentScroll+ virtualized+ />+ )+ const initialCells = new Set(renderCell.mock.calls.map(([value]) => value))+ expect(initialCells.size).toBeGreaterThan(0)+ expect(initialCells.size).toBeLessThan(data.length)+ renderCell.mockClear()++ fireEvent.scroll(container.querySelector('.ScrollableShadows__inner')!, { target: { scrollTop: 180 } })++ expect(renderCell).toHaveBeenCalled()+ expect(renderCell.mock.calls.every(([value]) => !initialCells.has(value))).toBe(true)+ } finally {+ cleanup()+ height.mockRestore()+ width.mockRestore()+ }+ })+it.each([[true, ['alpha', 'gamma', 'beta']],[false, ['alpha', 'beta', 'gamma']],diff --git a/frontend/src/lib/lemon-ui/LemonTable/LemonTable.tsx b/frontend/src/lib/lemon-ui/LemonTable/LemonTable.tsxindex 9a0720d2cf71..9c8c1d786dcb 100644--- a/frontend/src/lib/lemon-ui/LemonTable/LemonTable.tsx+++ b/frontend/src/lib/lemon-ui/LemonTable/LemonTable.tsx@@ -1,5 +1,6 @@import './LemonTable.scss'+import { useVirtualizer } from '@tanstack/react-virtual'import clsx from 'clsx'import { useActions, useValues } from 'kea'import { router } from 'kea-router'@@ -129,6 +130,8 @@ export interface LemonTableProps<T extends Record<string, any>, K extends BulkSe* Whether the table content is allowed to scroll inside its container.*/allowContentScroll?: boolean+ /** Requires a bounded scroll container. Expandable rows use the normal rendering path. */+ virtualized?: boolean/*** Whether the header row stays visible while the page scrolls. The header pins to the scene's scroll* container from the `@2xl/main-content` breakpoint up, the same as `SceneStickyBar`. Set the@@ -192,6 +195,7 @@ export function LemonTable<T extends Record<string, any>, K extends BulkSelectiomaxHeaderWidth,hideScrollbar,allowContentScroll = false,+ virtualized = false,stickyHeader = false,rowActions,hideSortingIndicatorWhenInactive = false,@@ -302,6 +306,45 @@ export function LemonTable<T extends Record<string, any>, K extends BulkSelectio}, [dataSource, currentSorting, baseColumns])const paginationState = usePagination(sortedDataSource, pagination, id)+ const virtualizeRows = virtualized && allowContentScroll && !expandable+ const scrollMargin = tableRef.current?.tHead?.offsetHeight ?? 0+ const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({+ count: paginationState.dataSourcePage.length,+ getScrollElement: () => scrollRef.current,+ estimateSize: () => 36,+ overscan: 5,+ enabled: virtualizeRows,+ scrollMargin,+ })+ const onVirtualizedRow = useCallback(+ (record: T, index: number): HTMLProps<HTMLTableRowElement> & { 'data-index': number } => ({+ ...onRow?.(record, index),+ ref: rowVirtualizer.measureElement,+ 'data-index': index - paginationState.currentStartIndex,+ }),+ [onRow, rowVirtualizer.measureElement, paginationState.currentStartIndex]+ )+ const virtualRows = rowVirtualizer.getVirtualItems()+ const rowIndexes = virtualizeRows+ ? virtualRows.map((row) => row.index)+ : paginationState.dataSourcePage.map((_, index) => index)+ const paddingTop = virtualRows.length ? Math.max(0, virtualRows[0].start - scrollMargin) : 0+ const paddingBottom = virtualRows.length+ ? Math.max(0, rowVirtualizer.getTotalSize() - (virtualRows[virtualRows.length - 1].end - scrollMargin))+ : 0++ useEffect(() => {+ if (virtualizeRows) {+ rowVirtualizer.scrollToOffset(0)+ }+ }, [+ virtualizeRows,+ rowVirtualizer,+ dataSource,+ paginationState.currentPage,+ currentSorting?.columnKey,+ currentSorting?.order,+ ])const resolveRowKey = useMemo<(record: T) => K>(() => {if (bulkSelection?.getKey) {@@ -779,8 +822,17 @@ export function LemonTable<T extends Record<string, any>, K extends BulkSelectio</thead>)}<tbody>+ {virtualizeRows && paddingTop > 0 && (+ <tr aria-hidden style={{ border: 0 }}>+ <td+ colSpan={headerLoaderColSpan}+ style={{ height: paddingTop, padding: 0, border: 0 }}+ />+ </tr>+ )}{paginationState.dataSourcePage.length ? (- paginationState.dataSourcePage.map((record, rowIndex) => {+ rowIndexes.map((rowIndex) => {+ const record = paginationState.dataSourcePage[rowIndex]const rowKeyDetermined = rowKey? typeof rowKey === 'function'? rowKey(record, rowIndex)@@ -807,7 +859,7 @@ export function LemonTable<T extends Record<string, any>, K extends BulkSelectiorowRibbonColorDetermined={rowRibbonColorDetermined}rowStatusDetermined={rowStatusDetermined}columnGroups={columnGroups}- onRow={onRow}+ onRow={virtualizeRows ? onVirtualizedRow : onRow}expandable={expandable}rowCount={paginationState.dataSourcePage.length}firstColumnSticky={firstColumnSticky}@@ -848,6 +900,14 @@ export function LemonTable<T extends Record<string, any>, K extends BulkSelectio<td colSpan={headerLoaderColSpan}>{emptyState || `No ${nouns[1]}`}</td></tr>)}+ {virtualizeRows && paddingBottom > 0 && (+ <tr aria-hidden style={{ border: 0 }}>+ <td+ colSpan={headerLoaderColSpan}+ style={{ height: paddingBottom, padding: 0, border: 0 }}+ />+ </tr>+ )}</tbody></table>{footer && <div className="LemonTable__footer">{footer}</div>}diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsxindex 2982a194162f..aa1558e18b9e 100644--- a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx+++ b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx@@ -150,6 +150,7 @@ function ColumnHeaderTitle({export const Table = (props: TableProps): JSX.Element => {const { isDarkModeOn } = useValues(themeLogic)+ const virtualized = !!props.embedded && !!props.context?.dataVisualizationTableVirtualizedconst {tabularData,@@ -418,6 +419,9 @@ export const Table = (props: TableProps): JSX.Element => {rowClassName="DataVizRow"embedded={props.embedded}allowContentScroll={!!props.embedded}+ virtualized={virtualized}+ tableLayout={virtualized ? 'fixed' : 'auto'}+ tableStyle={virtualized ? { minWidth: `${tabularColumns.length * 12}rem` } : undefined}/></>)diff --git a/frontend/src/queries/types.ts b/frontend/src/queries/types.tsindex bba7e5b26435..10fc1cb456f3 100644--- a/frontend/src/queries/types.ts+++ b/frontend/src/queries/types.ts@@ -68,6 +68,8 @@ export interface QueryContext<Q extends QuerySchema = QuerySchema> {dataTableMaxPaginationRows?: number/** Keep the Data Table toolbar fixed while its table content scrolls. */dataTableAllowContentScroll?: boolean+ /** Virtualize rows in an embedded SQL result table with a bounded height. */+ dataVisualizationTableVirtualized?: boolean/** Keep the Data Table header row visible while the page scrolls. See `LemonTable`'s `stickyHeader`. */dataTableStickyHeader?: boolean/** Override the nouns used by Data Table counts and pagination. */diff --git a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsxindex c96febc04047..d386da36181b 100644--- a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx+++ b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx@@ -1753,7 +1753,87 @@ export const BICatalogSnapshot: Story = {play: async ({ canvasElement }) => {const canvas = within(canvasElement)await canvas.findByRole('link', { name: 'View catalog definition' }, { timeout: 15000 })- await userEvent.click(await canvas.findByRole('button', { name: /^Run$/ }))+ await userEvent.click(await canvas.findByRole('button', { name: 'Run worksheet' }))await expect(canvas.findByText('450', { exact: true })).resolves.toBeVisible()},}++export const BISourcePreviewLargeSample: Story = {+ ...BIModeWorksheet,+ parameters: {+ ...BIModeWorksheet.parameters,+ msw: {+ mocks: {+ ...BIModeWorksheet.parameters!.msw.mocks,+ get: {+ ...BIModeWorksheet.parameters!.msw.mocks.get,+ '/api/projects/:team_id/data_catalog/relationship_proposals/': {+ count: 0,+ next: null,+ results: [],+ },+ },+ post: {+ ...BIModeWorksheet.parameters!.msw.mocks.post,+ '/api/projects/:team_id/file_system/home_folder/': { id: 'example-home', path: 'Users/Example' },+ '/api/environments/:team_id/query/HogQLQuery/': async ({ request }: MockResolverInfo) => {+ const { query } = (await request.json()) as { query: { query: string } }+ if (query.query.startsWith('SELECT *')) {+ const limit = Number(query.query.match(/LIMIT (\d+)/)?.[1] ?? 1000)+ return {+ columns: [+ 'row_number',+ 'description',+ ...Array.from({ length: 8 }, (_, index) => `quantity_${index + 1}`),+ ],+ types: [+ ['row_number', 'Int64'],+ ['description', 'String'],+ ...Array.from({ length: 8 }, (_, index) => [`quantity_${index + 1}`, 'Int64']),+ ],+ results: Array.from({ length: limit }, (_, index) => [+ index + 1,+ `Example source row ${index + 1}`,+ ...Array.from({ length: 8 }, (_, column) => (index + column) % 17),+ ]),+ hasMore: false,+ }+ }+ return {+ columns: [+ ...getBIResultDimensions(BI_WORKSHEET_CONFIG).map(({ column }) => column),+ ...getBIResultMeasureColumns(BI_WORKSHEET_CONFIG).map(({ column }) => column),+ ],+ types: ['DateTime', 'String', 'Float64'],+ results: [['2026-06-01', 'purchase', 120]],+ hasMore: false,+ }+ },+ },+ },+ },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ const openPreview = await canvas.findByText('View source data', {}, { timeout: 15000 })+ await waitFor(() => expect(openPreview.closest('button')).toHaveAttribute('aria-disabled', 'false'), {+ timeout: 15000,+ })+ await userEvent.click(openPreview)+ const body = within(canvasElement.ownerDocument.body)+ await body.findByText('Example source row 1', {}, { timeout: 15000 })+ const table = canvasElement.ownerDocument.querySelector<HTMLElement>('[data-attr="bi-source-preview-table"]')!+ expect(table.querySelectorAll('tbody tr[data-row-key]').length).toBeLessThan(50)+ const scroll = table.querySelector<HTMLElement>('.ScrollableShadows__inner')!+ scroll.scrollTop = scroll.scrollHeight+ await body.findByText('Example source row 500')+ await userEvent.click(within(table).getByLabelText('Next page'))+ await body.findByText('Example source row 501')+ expect(scroll.scrollTop).toBe(0)+ expect(table.querySelectorAll('tbody tr[data-row-key]').length).toBeLessThan(50)+ scroll.scrollTop = scroll.scrollHeight+ await body.findByText('Example source row 1000')+ await userEvent.click(within(table).getByLabelText('Previous page'))+ await body.findByText('Example source row 1')+ },+}diff --git a/products/business_intelligence/frontend/BIEditor.tsx b/products/business_intelligence/frontend/BIEditor.tsxindex 10811e3845d0..87e021ecc63f 100644--- a/products/business_intelligence/frontend/BIEditor.tsx+++ b/products/business_intelligence/frontend/BIEditor.tsx@@ -2,7 +2,7 @@ import { BindLogic, useActions, useValues } from 'kea'import { useRef, type ReactNode, type Ref } from 'react'import { IconX } from '@posthog/icons'-import { LemonBanner, LemonButton, LemonTag } from '@posthog/lemon-ui'+import { LemonBanner, LemonButton, LemonTag, Link } from '@posthog/lemon-ui'import { Resizer } from 'lib/components/Resizer/Resizer'import { resizerLogic, ResizerLogicProps } from 'lib/components/Resizer/resizerLogic'@@ -87,13 +87,11 @@ export function BIEditor({return (<BindLogic logic={biEditorLogic} props={{ tabId }}><div className="@container/bi-editor flex min-h-0 flex-1 flex-col" data-attr="bi-catalog-snapshot">- <LemonBanner type="info">- Query snapshot: dates and dimensions are fixed by the metric definition. Changing the chart does- not regroup the data. This copy does not track later catalog edits.+ <LemonBanner type="info" dismissKey="bi-query-snapshot">+ This is a fixed SQL copy. Use View SQL to edit its dates or grouping in the SQL editor. Catalog+ changes won't update this copy.{' '}{config.catalogMetric && (- <LemonButton size="xsmall" to={urls.dataCatalogMetric(config.catalogMetric)}>- View catalog definition- </LemonButton>+ <Link to={urls.dataCatalogMetric(config.catalogMetric)}>View catalog definition</Link>)}</LemonBanner><BIToolbar />diff --git a/products/business_intelligence/frontend/BISourceContext.tsx b/products/business_intelligence/frontend/BISourceContext.tsxindex b51ea20301c3..6c0bd5053610 100644--- a/products/business_intelligence/frontend/BISourceContext.tsx+++ b/products/business_intelligence/frontend/BISourceContext.tsx@@ -26,7 +26,12 @@ export function BISourceContext({ table }: { table: DatabaseSchemaTable }): JSX.<span className="mr-1">Catalog details</span><TableCertificationTag certification={table.certification} /></summary>- <div className="flex flex-col gap-2 py-2">+ <div+ className="flex max-h-48 flex-col gap-2 overflow-y-auto overscroll-contain py-2"+ role="region"+ aria-label="Catalog details"+ tabIndex={0}+ >{description && <p className="m-0 break-words text-secondary">{description}</p>}{table.certification?.notes && <p className="m-0 break-words">{table.certification.notes}</p>}<LemonButtondiff --git a/products/business_intelligence/frontend/BISourcePreviewModal.tsx b/products/business_intelligence/frontend/BISourcePreviewModal.tsxindex 8c05570a72a9..3a7c4da9ab86 100644--- a/products/business_intelligence/frontend/BISourcePreviewModal.tsx+++ b/products/business_intelligence/frontend/BISourcePreviewModal.tsx@@ -57,7 +57,14 @@ export function BISourcePreviewModal({ tabId }: { tabId: string }): JSX.Element</details>)}{query ? (- <Query query={query} context={{ insightProps }} readOnly embedded />+ <div className="flex h-96 min-h-0 flex-col" data-attr="bi-source-preview-table">+ <Query+ query={query}+ context={{ insightProps, dataVisualizationTableVirtualized: true }}+ readOnly+ embedded+ />+ </div>) : (<LemonBanner type="warning">Check the source and row filters before viewing this sample.diff --git a/products/business_intelligence/frontend/BIStarters.tsx b/products/business_intelligence/frontend/BIStarters.tsxindex 92fe974a6557..9ad9202137a4 100644--- a/products/business_intelligence/frontend/BIStarters.tsx+++ b/products/business_intelligence/frontend/BIStarters.tsx@@ -36,29 +36,11 @@ const EVENTS_CONFIG: BIConfig = {}export function BIStarters(): JSX.Element {- const { metrics, sources } = useValues(biStartersLogic)+ const { sources } = useValues(biStartersLogic)return (<section className="flex flex-col gap-2" aria-label="Worksheet starting points"><h3 className="m-0">Start with a question</h3><div className="flex flex-wrap gap-2">- {metrics.map((metric) => (- <LemonButton- key={metric.id}- type="secondary"- size="small"- className="max-w-full"- to={`${urls.businessIntelligenceNew()}?metric=${encodeURIComponent(metric.name)}`}- tooltip={`${metric.description} · Fixed query snapshot; dates and dimensions are not editable.`}- onClick={() =>- captureBIWorksheetAction('starter_selected', DEFAULT_BI_CONFIG, { starter_kind: 'metric' })- }- >- <span className="flex items-center gap-1 min-w-0">- <span className="truncate">Explore {metric.display_name || metric.name}</span>- <LemonTag type="success">Approved metric</LemonTag>- </span>- </LemonButton>- ))}{sources.map((source) => {const config = { ...DEFAULT_BI_CONFIG, source: { table: source.target_name } }return (@@ -94,8 +76,8 @@ export function BIStarters(): JSX.Element {</LemonButton></div><p className="m-0 text-xs text-secondary">- Choose a starting point, check its definition, then Run. Save your worksheet to return to it or add it- to a dashboard.+ Choose a starting point, add fields, then Run. Save your worksheet to return to it or add it to a+ dashboard.</p></section>)diff --git a/products/business_intelligence/frontend/BusinessIntelligenceScene.tsx b/products/business_intelligence/frontend/BusinessIntelligenceScene.tsxindex 01d47899e119..c77f99b40d19 100644--- a/products/business_intelligence/frontend/BusinessIntelligenceScene.tsx+++ b/products/business_intelligence/frontend/BusinessIntelligenceScene.tsx@@ -84,6 +84,7 @@ export function BusinessIntelligenceScene({ tabId = 'bi-default' }: { tabId?: stnavigateHierarchy,setSqlPreviewOpen,refreshInsightFromAgent,+ runQuery,} = useActions(logic)const hierarchyParent = getBIHierarchyParent(worksheet)@@ -320,6 +321,16 @@ export function BusinessIntelligenceScene({ tabId = 'bi-default' }: { tabId?: st: 'Drag or double-click a field to start. Dimensions define groups; measures calculate a value for each group.': 'Select a table and add fields to build your worksheet.'}</span>+ {generatedQuery && (+ <LemonButton+ type="primary"+ onClick={runQuery}+ aria-label="Run worksheet"+ data-attr="bi-run-empty-worksheet"+ >+ Run+ </LemonButton>+ )}{worksheet.config.source &&!worksheet.config.rows.length &&!worksheet.config.columns.length &&diff --git a/products/business_intelligence/frontend/biStartersLogic.test.ts b/products/business_intelligence/frontend/biStartersLogic.test.tsindex f471f7aa0d9d..4808057381ca 100644--- a/products/business_intelligence/frontend/biStartersLogic.test.ts+++ b/products/business_intelligence/frontend/biStartersLogic.test.ts@@ -5,27 +5,15 @@ import { initKeaTests } from '~/test/init'import { biStartersLogic } from './biStartersLogic'-it('requests one bounded, server-filtered page per starter list and excludes drifted definitions', async () => {+it('requests one bounded, server-filtered page of certified sources', async () => {initKeaTests()- let metricParams: Record<string, string> = {}let certificationParams: Record<string, string> = {}- const metrics = jest.fn(({ request }: { request: Request }) => {- metricParams = Object.fromEntries(new URL(request.url).searchParams)- return {- results: [- { name: 'current', status: 'approved', is_drifted: false, definition_kind: 'HogQLQuery' },- { name: 'drifted', status: 'approved', is_drifted: true, definition_kind: 'HogQLQuery' },- ],- next: 'next-page',- }- })const certifications = jest.fn(({ request }: { request: Request }) => {certificationParams = Object.fromEntries(new URL(request.url).searchParams)return { results: [], next: 'next-page' }})useMocks({get: {- '/api/projects/:team_id/data_catalog/metrics/': metrics,'/api/projects/:team_id/data_catalog/certifications/': certifications,},})@@ -33,10 +21,7 @@ it('requests one bounded, server-filtered page per starter list and excludes driconst unmount = logic.mount()try {await expectLogic(logic).toFinishAllListeners()- expect(logic.values.metrics.map((metric) => metric.name)).toEqual(['current'])- expect(metrics).toHaveBeenCalledTimes(1)expect(certifications).toHaveBeenCalledTimes(1)- expect(metricParams).toEqual({ status: 'approved', definition_kind: 'HogQLQuery', limit: '3' })expect(certificationParams).toEqual({ status: 'certified', limit: '3' })} finally {unmount()@@ -47,7 +32,6 @@ it('keeps the library usable when optional catalog endpoints are unavailable', ainitKeaTests()useMocks({get: {- '/api/projects/:team_id/data_catalog/metrics/': [403, { detail: 'Unavailable' }],'/api/projects/:team_id/data_catalog/certifications/': [403, { detail: 'Unavailable' }],},})@@ -55,9 +39,7 @@ it('keeps the library usable when optional catalog endpoints are unavailable', aconst unmount = logic.mount()try {await expectLogic(logic).toFinishAllListeners()- expect(logic.values.metrics).toEqual([])expect(logic.values.sources).toEqual([])- expect(logic.values.metricsLoading).toBe(false)expect(logic.values.sourcesLoading).toBe(false)} finally {unmount()diff --git a/products/business_intelligence/frontend/biStartersLogic.ts b/products/business_intelligence/frontend/biStartersLogic.tsindex 2269822aa185..e3d8279b312d 100644--- a/products/business_intelligence/frontend/biStartersLogic.ts+++ b/products/business_intelligence/frontend/biStartersLogic.ts@@ -3,34 +3,17 @@ import { loaders } from 'kea-loaders'import { teamLogic } from 'scenes/teamLogic'-import { dataCatalogCertificationsList, dataCatalogMetricsList } from 'products/data_catalog/frontend/generated/api'-import { DataCatalogCertificationApi, DataCatalogMetricApi } from 'products/data_catalog/frontend/generated/api.schemas'+import { dataCatalogCertificationsList } from 'products/data_catalog/frontend/generated/api'+import { DataCatalogCertificationApi } from 'products/data_catalog/frontend/generated/api.schemas'// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface biStartersLogicValues {- metrics: DataCatalogMetricApi[]- metricsLoading: booleansources: DataCatalogCertificationApi[]sourcesLoading: boolean}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface biStartersLogicActions {- loadMetrics: () => any- loadMetricsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadMetricsSuccess: (- metrics: DataCatalogMetricApi[],- payload?: any- ) => {- metrics: DataCatalogMetricApi[]- payload?: any- }loadSources: () => anyloadSourcesFailure: (error: string,@@ -53,24 +36,6 @@ export type biStartersLogicType = MakeLogicType<biStartersLogicValues, biStarterexport const biStartersLogic = kea<biStartersLogicType>([path(['products', 'business_intelligence', 'biStartersLogic']),loaders({- metrics: [- [] as DataCatalogMetricApi[],- {- loadMetrics: async (): Promise<DataCatalogMetricApi[]> => {- try {- const response = await dataCatalogMetricsList(String(teamLogic.values.currentTeamId), {- status: 'approved',- definition_kind: 'HogQLQuery',- limit: 3,- })- return response.results.filter((metric) => !metric.is_drifted)- } catch {- // Optional starters must not block the worksheet library when the catalog is unavailable.- return []- }- },- },- ],sources: [[] as DataCatalogCertificationApi[],{@@ -90,7 +55,6 @@ export const biStartersLogic = kea<biStartersLogicType>([],}),afterMount(({ actions }) => {- actions.loadMetrics()actions.loadSources()}),])diff --git a/products/surveys/frontend/e2e/settings.spec.ts b/products/surveys/frontend/e2e/settings.spec.tsindex aaac1663d315..ce11a398f928 100644--- a/products/surveys/frontend/e2e/settings.spec.ts+++ b/products/surveys/frontend/e2e/settings.spec.ts@@ -58,7 +58,7 @@ test.describe('Survey Settings', () => {await expect(page).toHaveTitle('Surveys • PostHog')await page.goToMenuItem('settings')- await page.locator('#main-content').getByRole('link', { name: 'Surveys', exact: true }).click()+ await page.getByRole('main').getByText('Surveys', { exact: true }).click()await expect(page.getByTestId('opt-in-surveys-switch')).not.toBeDisabled()await expect(page.getByText('Surveys opt in updated')).not.toBeVisible()await toggleSurveysSettingsAndWaitResponse(page)