Handle cursors on refresh
This commit is contained in:
parent
e91f9ea5cd
commit
5e8a2de089
|
@ -150,7 +150,7 @@
|
|||
|
||||
const removeUser = async id => {
|
||||
await groups.actions.removeUser(groupId, id)
|
||||
fetchGroupUsers.getInitialData()
|
||||
fetchGroupUsers.refresh()
|
||||
}
|
||||
|
||||
const removeApp = async app => {
|
||||
|
|
|
@ -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,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue