Keep Sparkle resetUpdateCycle on the main actor

SPUUpdater is a main-thread-only API; calling resetUpdateCycle() from a
detached utility task violated Sparkle's threading contract and raised
a Swift 6 concurrency error (non-Sendable SPUUpdater captured in a
detached task). A plain main-actor Task keeps the deferral that avoids
running the feed-cache work synchronously inside the didSet.
This commit is contained in:
Arkadiusz Fal
2026-06-24 18:52:32 +02:00
parent 80ec622e03
commit bef29a79a8

View File

@@ -33,12 +33,12 @@ final class AppUpdater {
didSet { didSet {
guard oldValue != wantsBetaChannel else { return } guard oldValue != wantsBetaChannel else { return }
UserDefaults.standard.set(wantsBetaChannel, forKey: Self.wantsBetaKey) UserDefaults.standard.set(wantsBetaChannel, forKey: Self.wantsBetaKey)
// Trigger re-check so the delegate re-reads channels. Deferred off // Trigger re-check so the delegate re-reads channels. Deferred to
// the main thread resetUpdateCycle may synchronously touch the // a later main-actor turn so the feed-cache work doesn't run
// scheduler's feed cache which can stutter SwiftUI scrolling. // synchronously inside this didSet (which can stutter SwiftUI
let updater = self.updaterController.updater // scrolling). Must stay on main: SPUUpdater is main-thread-only.
Task.detached(priority: .utility) { Task { @MainActor in
updater.resetUpdateCycle() self.updaterController.updater.resetUpdateCycle()
} }
} }
} }