diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index 086454cb9..420b9da02 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -14,8 +14,12 @@ final class TimelineProxy: TimelineProxyProtocol { private var backPaginationStatusObservationToken: TaskHandle? - // The default values don't matter here, they will be updated when calling subscribeToPagination. - private let backPaginationStatusSubject = CurrentValueSubject(.timelineEndReached) + // The default values shouldn't matter here as they will be updated when calling subscribeToPagination + // but empirically we randomly see the timeline start virtual item when we shouldn't. + // We believe there's a race condition between the default values the status publisher + // so we're going to default the backwards one to .idle. Worst case it's going to do + // one extra back pagination. + private let backPaginationStatusSubject = CurrentValueSubject(.idle) private let forwardPaginationStatusSubject = CurrentValueSubject(.timelineEndReached) private let kind: TimelineKind