This commit is contained in:
Adria Navarro 2023-05-05 13:05:08 +01:00
parent 916edf47d4
commit d79af79bf1
1 changed files with 8 additions and 7 deletions

View File

@ -367,14 +367,8 @@ export default class DataFetch {
let { cursors } = get(this.store)
const { pageNumber } = get(this.store)
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) {
// If the full page is gone but we have previous pages, navigate to the previous page
this.store.update($store => ({
...$store,
loading: false,
@ -383,6 +377,13 @@ export default class DataFetch {
return await this.prevPage()
}
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
}
this.store.update($store => ({
...$store,
rows,