1
0
Fork 0
mirror of synced 2024-07-11 01:06:04 +12:00

Handle cursors on refresh

This commit is contained in:
Adria Navarro 2023-05-05 12:10:49 +01:00
parent e91f9ea5cd
commit 5e8a2de089
2 changed files with 13 additions and 2 deletions

View file

@ -150,7 +150,7 @@
const removeUser = async id => {
await groups.actions.removeUser(groupId, id)
fetchGroupUsers.getInitialData()
fetchGroupUsers.refresh()
}
const removeApp = async app => {

View file

@ -362,13 +362,24 @@ export default class DataFetch {
return
}
this.store.update($store => ({ ...$store, loading: true }))
const { rows, info, error } = await this.getPage()
const { rows, info, error, cursor } = await this.getPage()
let { cursors } = get(this.store)
const { pageNumber } = get(this.store)
const currentNextCursor = cursors[pageNumber + 1]
if (currentNextCursor != cursor) {
cursors = cursors.slice(0, pageNumber + 1)
cursors[pageNumber + 1] = cursor
}
this.store.update($store => ({
...$store,
rows,
info,
loading: false,
error,
cursors,
}))
}