From 337b1189ec3d71a25a60a4df04eb3575826054a6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 20 Jun 2024 13:09:19 +0100 Subject: [PATCH] Fix race condition which prevented pagination if the initial page load in a table encountered the internal row join limit --- .../src/components/grid/stores/pagination.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/pagination.js b/packages/frontend-core/src/components/grid/stores/pagination.js index 1dbea6e0d2..f4fdee2ff4 100644 --- a/packages/frontend-core/src/components/grid/stores/pagination.js +++ b/packages/frontend-core/src/components/grid/stores/pagination.js @@ -15,8 +15,14 @@ export const initialise = context => { ) // Fetch next page when fewer than 25 remaining rows to scroll - remainingRows.subscribe(remaining => { - if (remaining < 25 && get(rowCount)) { + const needsNewPage = derived( + [remainingRows, rowCount], + ([$remainingRows, $rowCount]) => { + return $remainingRows < 25 && $rowCount + } + ) + needsNewPage.subscribe($needsNewPage => { + if ($needsNewPage) { rows.actions.loadNextPage() } })