mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
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:
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user