Handling last page removed
This commit is contained in:
parent
5e8a2de089
commit
916edf47d4
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue