Skip to content

2FA SwiftUI crashes in TicTacToe example #395

@rhys-rant

Description

@rhys-rant

Describe the bug
In the TicTacToe example application, when you choose the SwiftUI application flow and opt into the Two Factor Auth. section, when you tap "Next" after typing in 1234, the app with crash with the error:

Fatal error: "LoginAction.twoFactorDismissed" was received by an optional reducer when its state was "nil". This can happen for a few reasons:

with a long list of reasons as to why it's potentially crashed.

This crash appears to be caused by LoginSwiftView.swift line num. 71. where the app sends .twoFactorDismissed to the now nil'd out LoginState, as the NavigationLink receives false for the isActive binding.

To Reproduce

  • Open the TicTacToe sample application
  • Select SwiftUI version
  • Enter 2fa@test.com in the Email field
  • Enter password in the Password field
  • Tap Log in
  • Enter 1234 and tap Submit
  • App navigates to the New Game screen, then immediately crashes

Expected behavior
I expected the app to progress to the New Game screen and not crash 😅

Screenshots
Screenshot 2021-02-24 at 09 25 43

Environment

  • Xcode 12.4
  • Swift 5.3
  • Composable Architecture version 0.15.0

Additional context
If you login with the 2FA flow through the UIKit version, it doesn't crash, and retains the login if you navigate backwards and switch to the SwiftUI version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apple bugSomething isn't working due to a bug on Apple's platforms.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions