From 50cb75d0935de02befafb8512408d12d73ee21ce Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Wed, 6 Oct 2021 09:35:54 +1100 Subject: [PATCH] Stop CfdTable from refreshing CfdTable uses react-table which resets its state if the data sources changes. We don't want some state to reset, e.g. sorting and un-expanding because that will mess with the user if the table suddenly changes. Note: it looks like that the provided types are missing this field. It's been tested and it works as expected but we need to @ts-ignore because tsc would complain. --- frontend/src/components/cfdtables/CfdTable.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/components/cfdtables/CfdTable.tsx b/frontend/src/components/cfdtables/CfdTable.tsx index 648b12e..0241ccc 100644 --- a/frontend/src/components/cfdtables/CfdTable.tsx +++ b/frontend/src/components/cfdtables/CfdTable.tsx @@ -269,6 +269,9 @@ export function Table({ columns, tableData, hiddenColumns, renderDetails }: Tabl initialState: { hiddenColumns, }, + // @ts-ignore: this field exists and it works as expected. + autoResetExpanded: false, + autoResetSortBy: false, }, useSortBy, useExpanded,