Handling last page removed

This commit is contained in:
Adria Navarro 2023-05-05 13:03:53 +01:00
parent 5e8a2de089
commit 916edf47d4
1 changed files with 10 additions and 0 deletions

View File

@ -369,10 +369,20 @@ export default class DataFetch {
const currentNextCursor = cursors[pageNumber + 1]
if (currentNextCursor != cursor) {
// If the current cursor changed, all the next pages need to be updated, so we mark them as stale
cursors = cursors.slice(0, pageNumber + 1)
cursors[pageNumber + 1] = cursor
}
if (!rows.length && pageNumber > 0) {
this.store.update($store => ({
...$store,
loading: false,
cursors: cursors.slice(0, pageNumber),
}))
return await this.prevPage()
}
this.store.update($store => ({
...$store,
rows,