-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alert bug exploration #249
Conversation
| @@ -105,6 +105,7 @@ import SwiftUI | |||
| @available(tvOS 13, *) | |||
| @available(watchOS 6, *) | |||
| public struct ActionSheetState<Action> { | |||
| public let id = UUID() | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safe to identify in this fashion.
| @@ -163,16 +163,11 @@ extension View { | |||
| dismiss: Action | |||
| ) -> some View { | |||
|
|
|||
| let viewStore = ViewStore(store, removeDuplicates: { ($0 == nil) != ($1 == nil) }) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the primary issue. Replacing alert state outright would consider the change a duplicate.
| @@ -127,23 +128,44 @@ public struct ActionSheetState<Action> { | |||
| @available(macOS, unavailable) | |||
| @available(tvOS 13, *) | |||
| @available(watchOS 6, *) | |||
| extension ActionSheetState: Equatable where Action: Equatable {} | |||
| extension ActionSheetState: Equatable where Action: Equatable { | |||
| public static func == (lhs: Self, rhs: Self) -> Bool { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to do custom implementations of Equatable, Hashable, and CustomDebugOutputConvertible now to avoid the UUID being different in tests...maybe you have a better idea than hiding a UUID inside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Seems like a good way to do this.
A user encountered a bug here: https://forums.swift.org/t/how-to-show-alerts-from-two-actions-one-after-the-other/39214
This branch should hopefully fix!