Timeline: Check for task cancellation before loading next page

This commit is contained in:
Thomas Ricouard 2023-02-26 19:09:21 +01:00
parent 0f8c481bcb
commit 8c4b286751

View file

@ -304,7 +304,9 @@ extension TimelineViewModel: StatusesFetcher {
var allStatuses: [Status] = [] var allStatuses: [Status] = []
var latestMinId = minId var latestMinId = minId
do { do {
while var newStatuses: [Status] = while
!Task.isCancelled,
var newStatuses: [Status] =
try await client.get(endpoint: timeline.endpoint(sinceId: nil, try await client.get(endpoint: timeline.endpoint(sinceId: nil,
maxId: nil, maxId: nil,
minId: latestMinId, minId: latestMinId,