Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Map-based backstack crashes when popping. #63

Description

@rjrjr

If you modify BackstackTransitionsTest.assertTransition to build its backstacks out of Map<Int, String>, like so, you crash with NoSuchElementException when popping. We're popping to a list that no longer includes the information to paint the outgoing screen, which is a pretty realistic situation.

    val firstBackstack = mapOf(1 to "one")
    val secondBackstack = mapOf(1 to "one", 2 to "two")
    var backstack by mutableStateOf(if (forward) firstBackstack else secondBackstack)
    compose.mainClock.autoAdvance = false
    compose.setContent {
      Backstack(
        backstack.keys.toList(),
        frameController = rememberTransitionController(
          animationSpec = animation,
          transition = transition
        )
      ) { BasicText(backstack.getValue(it)) }
    }

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions