From 72b8d387cc4e5ad0164181f728b7f602675f2e92 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Sep 2020 16:32:02 +0100 Subject: [PATCH] Fix TablePagination crashing when non array data values are used --- .../database/DataTable/TablePagination.svelte | 3 +- .../DataTable/modals/DeleteTable.svelte | 64 ------------------- .../DataTable/modals/DeleteView.svelte | 62 ------------------ 3 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 packages/builder/src/components/database/DataTable/modals/DeleteTable.svelte delete mode 100644 packages/builder/src/components/database/DataTable/modals/DeleteView.svelte diff --git a/packages/builder/src/components/database/DataTable/TablePagination.svelte b/packages/builder/src/components/database/DataTable/TablePagination.svelte index 508ee60b23..e43b8f728d 100644 --- a/packages/builder/src/components/database/DataTable/TablePagination.svelte +++ b/packages/builder/src/components/database/DataTable/TablePagination.svelte @@ -8,7 +8,8 @@ let numPages = 0 - $: numPages = Math.ceil(data.length / ITEMS_PER_PAGE) + $: numPages = Math.ceil((data?.length ?? 0) / ITEMS_PER_PAGE) + $: console.log(numPages) const next = () => { if (currentPage + 1 === numPages) return diff --git a/packages/builder/src/components/database/DataTable/modals/DeleteTable.svelte b/packages/builder/src/components/database/DataTable/modals/DeleteTable.svelte deleted file mode 100644 index c47b9e632a..0000000000 --- a/packages/builder/src/components/database/DataTable/modals/DeleteTable.svelte +++ /dev/null @@ -1,64 +0,0 @@ - - -
-
-
- -

Delete Table

-
-

- Are you sure you want to delete this table? All of your data will be - permanently removed. This action cannot be undone. -

-
- -
- - diff --git a/packages/builder/src/components/database/DataTable/modals/DeleteView.svelte b/packages/builder/src/components/database/DataTable/modals/DeleteView.svelte deleted file mode 100644 index 9d6c11cdb0..0000000000 --- a/packages/builder/src/components/database/DataTable/modals/DeleteView.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - -
-
-
- -

Delete View

-
-

- Are you sure you want to delete this view? All of your data will be - permanently removed. This action cannot be undone. -

-
- -
- -