Fix race condition which prevented pagination if the initial page load in a table encountered the internal row join limit

This commit is contained in:
Andrew Kingston 2024-06-20 13:09:19 +01:00
parent 763c04048c
commit 337b1189ec
No known key found for this signature in database
1 changed files with 8 additions and 2 deletions

View File

@ -15,8 +15,14 @@ export const initialise = context => {
) )
// Fetch next page when fewer than 25 remaining rows to scroll // Fetch next page when fewer than 25 remaining rows to scroll
remainingRows.subscribe(remaining => { const needsNewPage = derived(
if (remaining < 25 && get(rowCount)) { [remainingRows, rowCount],
([$remainingRows, $rowCount]) => {
return $remainingRows < 25 && $rowCount
}
)
needsNewPage.subscribe($needsNewPage => {
if ($needsNewPage) {
rows.actions.loadNextPage() rows.actions.loadNextPage()
} }
}) })