Alert state remaining when dismissing alert #2462
thompsondave
started this conversation in
General
Replies: 1 comment
-
Hi @thompsondave, you are missing one piece from using the presentation tools: you must use So you just need this: Reduce { state, action in
}
.ifLet(\.$alert, action: /Action.alert) Since this isn't an issue with the library I am going to convert it to a discussion. Feel free to continue the conversation there. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When using @PresentationState to display an alert with a
ButtonState(role: .cancel)
if you tap on the cancel button to dismiss the alert it is dismissed, but then try to navigate somewhere else e.g tap a button to show a fullScreenCover, the alert is presented again and the navigation to fullScreenCover fails. The reduce is then no longer able to display the fullScreenCover.The workaround for this is to always explicitly handle .alert(.dismiss) and set state.alert = nil
Checklist
main
branch of this package.Expected behavior
After dismissing the alert with ButtonState(role: .cancel) we should be able to navigate to a fullScreenCover without the alert state being shown again.
Actual behavior
After dismissing the alert with ButtonState(role: .cancel), attempting to navigate to a fullScreenCover shows the alert state again.
Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-09-15.at.08.23.37.mp4
Steps to reproduce
Attached minimal project:
TestComposableArchitecture.zip
The Composable Architecture version information
ea631ce892687f5432a833312292b80db238186a
Destination operating system
iOS 16
Xcode version information
XCode 14.3.1
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions