From 7fbd3853b1ba4767c61ef2faa6fa693ca9856b56 Mon Sep 17 00:00:00 2001 From: Speros Kokenes Date: Thu, 31 Oct 2024 15:04:19 -0400 Subject: [PATCH 1/2] fix: virtual scroll disabling --- packages/malloy-render/src/component/dashboard/dashboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/malloy-render/src/component/dashboard/dashboard.tsx b/packages/malloy-render/src/component/dashboard/dashboard.tsx index 5345482f7..3fa50ce0d 100644 --- a/packages/malloy-render/src/component/dashboard/dashboard.tsx +++ b/packages/malloy-render/src/component/dashboard/dashboard.tsx @@ -28,7 +28,7 @@ function DashboardItem(props: { resultMetadata: props.resultMetadata, customProps: { table: { - disableVirtualization: props.maxTableHeight, + disableVirtualization: !props.maxTableHeight, }, }, }); From abe204c1e9b5992c09aa4336fd1f56cbca2c32e7 Mon Sep 17 00:00:00 2001 From: Speros Kokenes Date: Fri, 1 Nov 2024 09:39:38 -0400 Subject: [PATCH 2/2] fix: virtual table measurement bug --- packages/malloy-render/src/component/table/table.tsx | 4 +++- packages/malloy-render/src/stories/line_charts.stories.malloy | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/malloy-render/src/component/table/table.tsx b/packages/malloy-render/src/component/table/table.tsx index ed95979b7..90b406288 100644 --- a/packages/malloy-render/src/component/table/table.tsx +++ b/packages/malloy-render/src/component/table/table.tsx @@ -393,7 +393,9 @@ const MalloyTableRoot = (_props: { if (props.scrollEl) scrollEl = props.scrollEl; let virtualizer: Virtualizer | undefined; - const [rowEstimate, setRowEstimate] = createSignal(28); + // Set arbitrarily large initial height to deal with weird measurement bug https://github.com/TanStack/virtual/issues/869 + // Could possibly try to pre-calculate a height estimate using metadata, but may be hard to do with potentially wrapping text so would have to add a buffer + const [rowEstimate, setRowEstimate] = createSignal(1000); const shouldVirtualize = tableCtx.root && !props.disableVirtualization; diff --git a/packages/malloy-render/src/stories/line_charts.stories.malloy b/packages/malloy-render/src/stories/line_charts.stories.malloy index ad8452de5..f25e0f43d 100644 --- a/packages/malloy-render/src/stories/line_charts.stories.malloy +++ b/packages/malloy-render/src/stories/line_charts.stories.malloy @@ -34,7 +34,7 @@ source: products is duckdb.table("data/products.parquet") extend { order_by: dcId } - # dashboard { table.max_heightX=100000 } + # dashboard { table.max_height=100000 } view: seriesCharts is { group_by: ` ` is 'Line Charts' # line_chart