forked from shadowfacts/Tusker
Fix crash when tapping Load More button with Disable Infinite Scrolling
This commit is contained in:
parent
8da89986df
commit
6a5753fac8
|
@ -96,7 +96,11 @@ actor TimelineLikeController<Item> {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let token = LoadAttemptToken()
|
let token = LoadAttemptToken()
|
||||||
guard await delegate.canLoadOlder() else {
|
guard await delegate.canLoadOlder(),
|
||||||
|
// Make sure we're still in the idle state before continuing on, since that may have chnaged while waiting for user input.
|
||||||
|
// If the load more cell appears, then the users scrolls up and back down, the VC may kick off a second loadOlder task
|
||||||
|
// but we only want one to proceed. The actor prevents a data race, and this prevents multiple simultaneousl loadOlder tasks from running.
|
||||||
|
state == .idle else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state = .loadingOlder(token, hasAddedLoadingIndicator: false)
|
state = .loadingOlder(token, hasAddedLoadingIndicator: false)
|
||||||
|
|
Loading…
Reference in New Issue