diff --git a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZoneDelegate.swift b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZoneDelegate.swift index 0f2318341..09e3c288b 100644 --- a/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZoneDelegate.swift +++ b/Modules/Account/Sources/Account/CloudKit/CloudKitAccountZoneDelegate.swift @@ -126,6 +126,8 @@ final class CloudKitAcountZoneDelegate: CloudKitZoneDelegate { if let existingUnclaimedFeeds = existingUnclaimedFeeds[containerExternalID] { for existingUnclaimedFeed in existingUnclaimedFeeds { + // Clear the top-level safety-net fallback (no-op if not there) so we don't leave a duplicate. + account.removeFeedFromTreeAtTopLevel(existingUnclaimedFeed) container.addFeedToTreeAtTopLevel(existingUnclaimedFeed) } self.existingUnclaimedFeeds.removeValue(forKey: containerExternalID) @@ -168,6 +170,13 @@ private extension CloudKitAcountZoneDelegate { } } } + + // Never leave a moved feed invisible: if its destination container(s) aren't known locally yet, + // keep it visible at the top level. addOrUpdateContainer relocates it when the folder record arrives. + // + if account.existingContainers(withFeed: feed).isEmpty { + account.addFeedToTreeAtTopLevel(feed) + } } @MainActor func createFeedIfNecessary(url: URL, name: String?, editedName: String?, homePageURL: String?, feedExternalID: String, container: Container) {