1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

Handling last page removed

This commit is contained in:
Adria Navarro 2023-05-05 13:03:53 +01:00
parent 5e8a2de089
commit 916edf47d4

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,