From 22b1ecf6be27310bb8b557c4e7bdca174c994da2 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 2 Apr 2026 13:36:27 +0300 Subject: [PATCH] Remove now unneeded `waitForInitialItems` TimelineProvider method. --- .../Services/Timeline/TimelineItemProvider.swift | 16 ---------------- .../Services/Timeline/TimelineProxy.swift | 3 --- 2 files changed, 19 deletions(-) diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift b/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift index 2ec6ceb06..9bbfaca73 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift @@ -66,17 +66,6 @@ class TimelineItemProvider: TimelineItemProviderProtocol { } } - /// A continuation to signal whether the initial timeline items have been loaded and processed. - private var hasLoadedInitialItemsContinuation: CheckedContinuation? - /// A method that allows `await`ing the first update of timeline items from the listener, as the items - /// aren't added directly to the provider upon initialisation and may take some time to come in. - func waitForInitialItems() async { - guard itemProxies.isEmpty else { return } - return await withCheckedContinuation { continuation in - hasLoadedInitialItemsContinuation = continuation - } - } - // MARK: - Private private func updateItemsWithDiffs(_ diffs: [TimelineDiff]) { @@ -101,11 +90,6 @@ class TimelineItemProvider: TimelineItemProviderProtocol { return updatedItems } - - if let hasLoadedInitialItemsContinuation { - hasLoadedInitialItemsContinuation.resume() - self.hasLoadedInitialItemsContinuation = nil - } } private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference? { diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index 73a7d5f09..9ece45dc5 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -53,9 +53,6 @@ final class TimelineProxy: TimelineProxyProtocol { await subscribeToPagination() let provider = await TimelineItemProvider(timeline: timeline, kind: kind, paginationStatePublisher: paginationStatePublisher) - // Make sure the existing items are built so that we have content in the timeline before - // determining whether or not the timeline should paginate to load more items. - await provider.waitForInitialItems() innerTimelineItemProvider = provider