-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
UIViewController.present
doesn't set state to nil
when dismissed
#3451
Labels
bug
Something isn't working due to a bug in the library.
Comments
This is the issue I reported in a discussion where the presentation tools didn't work in UIKit when scoping stores. Nice to have a true root cause and a reduction. |
Thanks for the repro! We'll look into this soon. |
present
doesn't set state to nil when dismissedUIViewController.present
doesn't set state to nil
when dismissed
All the debugging I've been doing, and it turns out this ticket lays out all my findings >:( I'll have to search the GitHub tickets next time. |
juliensagot
pushed a commit
to juliensagot/swift-composable-architecture
that referenced
this issue
Feb 24, 2025
Potential fix for pointfreeco#3451.
juliensagot
pushed a commit
to juliensagot/swift-composable-architecture
that referenced
this issue
Mar 1, 2025
Potential fix for pointfreeco#3451.
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
if the child state is
Identifiable
, the dismiss action is not be sent when dismissed.I think #3309 introduced this issue.
Checklist
main
branch of this package.Expected behavior
Send dismiss action when dismissed whatever the child state is
Identifiable
.Actual behavior
swift-composable-architecture/Sources/ComposableArchitecture/Observation/Store+Observation.swift
Lines 395 to 398 in fc5cbee
The
id
that determines whether or not to send the dismiss action is set by the following.swift-composable-architecture/Sources/ComposableArchitecture/Observation/Store+Observation.swift
Lines 338 to 348 in fc5cbee
However, when scoping for
present
, if the child state isnil
which is the most of the time, the id will also benil
, but_identifiableID(childState)
will not be. So the dismiss action will not be sent.This issue doesn't affect SwiftUI implementations because the scoped
Binding
is created every time whenbody
is called, including the time the child state becomes non-nil.I can work around this by mimicking SwiftUI's behavior, but it's so weird.
Reproducing project
TicTacToe
swift-composable-architecture/Examples/TicTacToe/tic-tac-toe/Sources/LoginUIKit/LoginViewController.swift
Lines 94 to 96 in fc5cbee
The
alert
is anAlertState
which isIdentifiable
.The Composable Architecture version information
1.14.0
The text was updated successfully, but these errors were encountered: