SwiftUI bug: Alert shows twice?

I'm running this on macOS. I looks like a bug to me. If I activate the menu item and confirm the alert, the alert pops up again. It only double-shows once; then it behaves correctly. In my real app, it double-shows every time.

If I uncomment that DispatchQueue.main.async, it "fixes" it.

macOS 11.2.3, Xcode 12.4.

Code Block swift
@main
struct DoubleAlertApp: App {
    @State var showAlert: Bool = false
    @StateObject var model: Model = .init()
    var body: some Scene {
        WindowGroup {
            ContentView().environmentObject(model)
                .background(EmptyView()
                    .alert(isPresented: $showAlert) {
                         Alert(title: Text("Test"),
                               message: Text("This will do something"),
                               primaryButton: .cancel(),
                               secondaryButton: .destructive(Text("Do it"), action: confirmedAction))
                    })
        }.commands {
            CommandGroup(replacing: CommandGroupPlacement.newItem) {
                Button(action: testAlert) {
                    Text("Test Alert")
                }.keyboardShortcut("t")
            }
        }
    }
    private func testAlert() {
        showAlert = true
    }
    private func confirmedAction() {
        print("confirmedAction")
        // DispatchQueue.main.async {
            self.model.change()
        //}
    }
}
class Model: ObservableObject {
    init() {}
    @Published var foo: Int = 0
    func change() {
        objectWillChange.send()
        foo += 1
    }
}
struct ContentView: View {
    @EnvironmentObject var model: Model
    var body: some View {
        Text("Hello. \(model.foo)").padding()
    }
}


I am seeing what is presumably the same issue, only with @ObservedObject instead of @State, and the alert is popping up not just twice but three times. async dodges the problem for me as well, though I do not understand exactly why. I do notice that debugging print statements added to the view’s body demonstrate that it is being executed exactly once for each time the alert appears.
Just to let you know, I tested your code as a macOS app, using xcode 12.5-beta on macos 11.3-beta
and all is working well for me with or without the DispatchQueue.main.async.
SwiftUI bug: Alert shows twice?
 
 
Q