From 2eac4afbc9ee7830a2ff1d206ec2b61df9f7c64d Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 5 Dec 2022 15:02:39 +0000 Subject: [PATCH] Force a re-initialisation of table data and paging when importing rows to a datasource --- .../src/components/backend/DataTable/DataTable.svelte | 8 +++++++- .../backend/DataTable/buttons/ImportButton.svelte | 2 +- .../backend/DataTable/modals/ImportModal.svelte | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte index 7cb368830e..32a8727d57 100644 --- a/packages/builder/src/components/backend/DataTable/DataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte @@ -117,6 +117,12 @@ const onUpdateRows = () => { fetch.refresh() } + + // When importing new rows it is better to reinitialise request/paging data. + // Not doing so causes inconsistency in paging behaviour and content. + const onImportData = () => { + fetch.getInitialData() + }
@@ -169,7 +175,7 @@ - + diff --git a/packages/builder/src/components/backend/DataTable/modals/ImportModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ImportModal.svelte index f7bb0e3cc8..bf44653e3d 100644 --- a/packages/builder/src/components/backend/DataTable/modals/ImportModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/ImportModal.svelte @@ -29,7 +29,7 @@ } // Always refresh rows just to be sure - dispatch("updaterows") + dispatch("importrows") }