diff --git a/Tusker/TimelineLikeController.swift b/Tusker/TimelineLikeController.swift index 523bc58db..3e41bdb71 100644 --- a/Tusker/TimelineLikeController.swift +++ b/Tusker/TimelineLikeController.swift @@ -96,7 +96,11 @@ actor TimelineLikeController { return } 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 } state = .loadingOlder(token, hasAddedLoadingIndicator: false)