Skip to content

Reset navigation state when popping multiple view controllers#324

Open
sk409 wants to merge 1 commit intopointfreeco:mainfrom
sk409:main
Open

Reset navigation state when popping multiple view controllers#324
sk409 wants to merge 1 commit intopointfreeco:mainfrom
sk409:main

Conversation

@sk409
Copy link
Copy Markdown

@sk409 sk409 commented Jan 20, 2026

Fixes #323

@areschoug
Copy link
Copy Markdown

Nice fix! This is a test to go with the change that fails on main but works with this fix.

  @MainActor
  func testPushViewController_ManualPopMultiple() async throws {
    let vc = BasicViewController(
      model: Model(pushedChild: Model(pushedChild: Model()))
    )
    let nav = UINavigationController(rootViewController: vc)
    try await setUp(controller: nav)

    await assertEventuallyEqual(nav.viewControllers.count, 3)

    nav.popToViewController(nav.viewControllers[0], animated: false)
    await assertEventuallyEqual(nav.viewControllers.count, 1)
    await assertEventuallyNil(vc.model.pushedChild)
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation state is not reset when popping multiple view controllers

2 participants