mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-23 00:40:59 +00:00
Don't load new pages if the timeline changed
This commit is contained in:
parent
3843d18f2f
commit
9f894858ae
1 changed files with 7 additions and 0 deletions
|
@ -221,6 +221,7 @@ extension TimelineViewModel: StatusesFetcher {
|
|||
// Fetch pages from the top most status of the tomeline.
|
||||
private func fetchNewPagesFrom(latestStatus: Status, client _: Client) async throws {
|
||||
canStreamEvents = false
|
||||
let initialTimeline = timeline
|
||||
var newStatuses: [Status] = await fetchNewPages(minId: latestStatus.id, maxPages: 10)
|
||||
|
||||
// Dedup statuses, a status with the same id could have been streamed in.
|
||||
|
@ -248,6 +249,12 @@ extension TimelineViewModel: StatusesFetcher {
|
|||
return
|
||||
}
|
||||
|
||||
// As this is a long runnign task we need to ensure that the user didn't changed the timeline filter.
|
||||
guard initialTimeline == timeline else {
|
||||
canStreamEvents = true
|
||||
return
|
||||
}
|
||||
|
||||
// Keep track of the top most status, so we can scroll back to it after view update.
|
||||
let topStatusId = statuses.first?.id
|
||||
|
||||
|
|
Loading…
Reference in a new issue