UIViewController.present
doesn't set state to nil
when dismissed
#3451
Labels
bug
Something isn't working due to a bug in the library.
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: