Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the navigation flow in FirebaseAuthSwiftUI by replacing the email-specific route removal with a more generic removeSignedOutRoutes() method. This is achieved by introducing an isSignedOutOnly property on AuthView to identify screens that are only relevant when signed out, updating AuthPickerContent to use this new method, and adding comprehensive unit tests. The review feedback suggests isolating the Navigator class and its corresponding test suite to @MainActor to ensure thread safety and compatibility with Swift 6 strict concurrency.
| func removeSignedOutRoutes() { | ||
| routes.removeAll(where: \.isSignedOutOnly) | ||
| } |
There was a problem hiding this comment.
To ensure thread safety and full compatibility with Swift 6 strict concurrency, the Navigator class should be isolated to the @MainActor. Since Navigator is @Observable, manages UI navigation state, and is directly bound to a NavigationStack in AuthPickerContent, mutating its routes property from non-main actors can lead to data races and runtime warnings.
| @testable import FirebaseAuthSwiftUI | ||
| import Testing | ||
|
|
||
| struct NavigatorTests { |
There was a problem hiding this comment.
Since Navigator manages UI navigation state and should be isolated to the @MainActor, the test suite NavigatorTests should also be marked with @MainActor to ensure all test cases run on the main thread and avoid concurrency warnings.
| struct NavigatorTests { | |
| @MainActor | |
| struct NavigatorTests { |
Opening an email sign-in link signs the user in but leaves the sheet on the email-link screen, so they see the send form again instead of the signed-in screen.
Changes
switchonAuthViewdecides, so a new route has to pick a side.EmailRouteTestscovers both sets and replaces the test that expected.passwordRecoveryto stay. The sign-in wiring itself is shown by the recordings below.Preview
Before
Expected: when a user wants to sign in with an email link, opening the link should take them straight to the signed-in screen.
email-link-before.mp4
After
email-link-after.mp4
Maintainer note: Fixes internal CPRN-673