fix(account): defer operation-error dismissal until the alert update ends

This commit is contained in:
2026-10-20 20:06:36 +02:00
parent 03bfbbe08b
commit d540a58594
+5 -3
View File
@@ -97,9 +97,7 @@ struct MainAppRoot: View {
AppL10n.string("account.error.title"), AppL10n.string("account.error.title"),
isPresented: accountOperationErrorBinding isPresented: accountOperationErrorBinding
) { ) {
Button(AppL10n.string("common.done")) { Button(AppL10n.string("common.done")) {}
accountSession.dismissOperationError()
}
} message: { } message: {
if let key = accountSession.operationErrorKey { if let key = accountSession.operationErrorKey {
Text(AppL10n.string(key)) Text(AppL10n.string(key))
@@ -326,9 +324,13 @@ struct MainAppRoot: View {
get: { accountSession.operationErrorKey != nil }, get: { accountSession.operationErrorKey != nil },
set: { isPresented in set: { isPresented in
if !isPresented { if !isPresented {
// SwiftUI writes this binding while updating the alert.
// Defer ObservableObject mutations until that update ends.
Task { @MainActor in
accountSession.dismissOperationError() accountSession.dismissOperationError()
} }
} }
}
) )
} }