mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-04 00:17:30 +01:00
Don't load new pages if the timeline changed
This commit is contained in:
parent
3843d18f2f
commit
9f894858ae
@ -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.
|
||||
@ -247,6 +248,12 @@ extension TimelineViewModel: StatusesFetcher {
|
||||
canStreamEvents = true
|
||||
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…
x
Reference in New Issue
Block a user