Skip to content

: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.

feat(data-modeling): paginate node detail columns (#102889)

Jovan Sakovicaf5c8879f0f6
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 11edf859a1d7..c99350f13fb0 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5928,6 +5928,10 @@ snapshots:
hash: v1.k794b7964.9110aa72356c45ec91a7ac3ac712904e28cf6b51a2b4ae6b032d60b524327427.6x6APOu5hbFc9JZVJBA1YQNgrxqszt3X2PfHorWYzrw
products-data-modeling-node-detail-scene--narrow-view--light:
hash: v1.k794b7964.42808291c239b90849edc8df8dfc10a69b0d73974de964412492325fdca5cb01.YfMvngDzfur4xRvb7O6msDlyuLsJkv7gcunSWAhNG5g
+ products-data-modeling-node-detail-scene--paginated-columns--dark:
+ hash: v1.k794b7964.5c623bdf59901765f55de0d7a1164d11feefa003292f7c0fc37a8bdcf778d3d2.UhfAB2qZz0EGEphjIL9GwkuEiuovUfT31-Ow5_gn2b8
+ products-data-modeling-node-detail-scene--paginated-columns--light:
+ hash: v1.k794b7964.b119e3e790d76d28ef0b53b7a7116717a4c2660347e23054a47922696c799548.YmPMhBqGr7MBKRXPb815ZXpqZp1V17KRg4PPq33hd5I
products-data-modeling-node-detail-scene--suspended-with-run-history--dark:
hash: v1.k794b7964.8777021fae0861f86ccd00ee197d14fcacf12d0ae1ba8a8fe7b38f20591cbc41.r_GyHK2h2ozRGIYXoZ3N4CAlJMClpccnfeC5TEgiDOo
products-data-modeling-node-detail-scene--suspended-with-run-history--light:
diff --git a/frontend/src/scenes/models/nodeDetailSceneLogic.test.ts b/frontend/src/scenes/models/nodeDetailSceneLogic.test.ts
index aa57196a6ae1..cdd60811b0ec 100644
--- a/frontend/src/scenes/models/nodeDetailSceneLogic.test.ts
+++ b/frontend/src/scenes/models/nodeDetailSceneLogic.test.ts
@@ -1,4 +1,4 @@
-import { cleanup, render, screen } from '@testing-library/react'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import { createElement } from 'react'
@@ -15,6 +15,7 @@ import { DataModelingNode, DataModelingNodeType, DataWarehouseSavedQuery } from
import { NodeDetailOverview } from './NodeDetailOverview'
import { NodeDetailSceneTab, nodeDetailSceneLogic } from './nodeDetailSceneLogic'
+import { NodeDetailQuery } from './tabs/NodeDetailQuery'
const NODE_ID = 'node-1'
const SAVED_QUERY_ID = 'saved-query-1'
@@ -118,6 +119,31 @@ describe('nodeDetailSceneLogic', () => {
expect(logic.values.availableTabs).toEqual(['lineage'])
})
+ it('shows ten columns on each query page', async () => {
+ savedQuery = {
+ ...savedQuery,
+ columns: Array.from({ length: 11 }, (_, index) => ({
+ name: `column_${index + 1}`,
+ hogql_value: `column_${index + 1}`,
+ type: 'string',
+ schema_valid: true,
+ })),
+ }
+ await mountScene(urls.nodeDetail(NODE_ID, 'query'))
+
+ render(createElement(NodeDetailQuery, { id: NODE_ID }))
+
+ expect(screen.getByText('column_10')).toBeTruthy()
+ expect(screen.queryByText('column_11')).toBeNull()
+ expect(screen.getByText('1-10 of 11 columns')).toBeTruthy()
+
+ fireEvent.click(screen.getByLabelText('Next page'))
+
+ expect(screen.queryByText('column_10')).toBeNull()
+ expect(screen.getByText('column_11')).toBeTruthy()
+ expect(screen.getByText('11 of 11 columns')).toBeTruthy()
+ })
+
it('lists every tab a saved query supports when data quality checks are on', async () => {
await mountScene(urls.nodeDetail(NODE_ID))
diff --git a/frontend/src/scenes/models/tabs/NodeDetailQuery.tsx b/frontend/src/scenes/models/tabs/NodeDetailQuery.tsx
index b5ecf71bd117..fd746b14de77 100644
--- a/frontend/src/scenes/models/tabs/NodeDetailQuery.tsx
+++ b/frontend/src/scenes/models/tabs/NodeDetailQuery.tsx
@@ -47,6 +47,8 @@ export function NodeDetailQuery({ id }: { id: string }): JSX.Element {
<h3 className="mb-0">Columns</h3>
<LemonTable
size="small"
+ key={id}
+ pagination={{ pageSize: 10, useUrl: false }}
dataSource={columns}
rowKey="name"
nouns={['column', 'columns']}
diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx
index 112dfeffb25b..6790c996b95a 100644
--- a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx
+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx
@@ -98,6 +98,30 @@ export const NarrowView: Story = {
],
}
+export const PaginatedColumns: Story = {
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],
+ '/api/environments/:team_id/warehouse_saved_queries/:id/': () => [
+ 200,
+ {
+ ...savedQuery,
+ columns: Array.from({ length: 11 }, (_, index) => ({
+ name: `column_${index + 1}`,
+ hogql_value: `column_${index + 1}`,
+ type: 'string',
+ schema_valid: true,
+ })),
+ },
+ ],
+ },
+ },
+ },
+ },
+}
+
export const MaterializedView: Story = {
parameters: {
msw: {