From 544ef6349c187cdfae8f1e5d26caa7689153d8e5 Mon Sep 17 00:00:00 2001 From: Arnei Date: Wed, 1 Nov 2023 16:09:08 +0100 Subject: [PATCH] Ensure there is an active page when calculating pages When (re-)calculating table page properties, it could happen that no page gets marked as active. However, the application assumes that there is always an active page. This fixes that. --- app/src/thunks/tableThunks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/thunks/tableThunks.ts b/app/src/thunks/tableThunks.ts index 503244d7d9..f01a5b1b84 100644 --- a/app/src/thunks/tableThunks.ts +++ b/app/src/thunks/tableThunks.ts @@ -698,5 +698,9 @@ const calculatePages = (numberOfPages, offset) => { }); } + if (pages.every(page => page.active === false)) { + pages[0].active = true; + } + return pages; };