From 4eb90d20a2f12873552a35d1b977b92842816abe Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 11 May 2023 01:58:04 -0700 Subject: [PATCH] Handle list auto size when vertical scroll appears --- src/renderer/components/virtual-table/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/renderer/components/virtual-table/index.tsx b/src/renderer/components/virtual-table/index.tsx index 046cab0b..82d9db02 100644 --- a/src/renderer/components/virtual-table/index.tsx +++ b/src/renderer/components/virtual-table/index.tsx @@ -10,6 +10,7 @@ import type { NewColumnsLoadedEvent, GridReadyEvent, GridSizeChangedEvent, + ModelUpdatedEvent, } from '@ag-grid-community/core'; import type { AgGridReactProps } from '@ag-grid-community/react'; import { AgGridReact } from '@ag-grid-community/react'; @@ -418,6 +419,14 @@ export const VirtualTable = forwardRef( [autoFitColumns, onGridSizeChanged], ); + const handleModelUpdated = useCallback( + (e: ModelUpdatedEvent) => { + if (!e?.api) return; + if (autoFitColumns) e.api?.sizeColumnsToFit?.(); + }, + [autoFitColumns], + ); + return (