From e5d2b38f947d2e02af3b250ac20d9a25f02af582 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:39:13 +0200 Subject: [PATCH] Spread state and initialState --- .../src/components/DataTable/DataTable.utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/design-system/src/components/DataTable/DataTable.utils.ts b/packages/design-system/src/components/DataTable/DataTable.utils.ts index 5811188f..2797db44 100644 --- a/packages/design-system/src/components/DataTable/DataTable.utils.ts +++ b/packages/design-system/src/components/DataTable/DataTable.utils.ts @@ -55,6 +55,8 @@ export const useDataTable = ({ columns, data, pageSize = 50, + state, + initialState, ...props }: UseDataTableProps) => { const [globalFilter, setGlobalFilter] = useState('') @@ -75,11 +77,12 @@ export const useDataTable = ({ getSortedRowModel: getSortedRowModel(), getPaginationRowModel: getPaginationRowModel(), onGlobalFilterChange: setGlobalFilter, - state: { globalFilter }, + state: { globalFilter, ...state }, initialState: { pagination: { pageSize, }, + ...initialState, }, ...props, })