Skip to content

Remove NavRoot #1247

@gabrielittner

Description

@gabrielittner

The motivation for this was a clearer distinction between the "root" destinations of a back stack and regular routes (represented by NavRoute). This way you don't accidentally use your start destinations in unexpected ways. It also avoids the issue of navigateBackTo with inclusive = true being called with the start destination, which would leave an empty back stack.

However it also comes with downsides:

  • Generally higher complexity in the API since there is BaseRoute, NavRoute and NavRoot.
  • For the serialization of routes in saved state we're currently just supporting BaseRoute and not the other 2 as base classes, it can be added but adds additional overhead.
  • In most cases showRoot is being used the same way that navigateBackTo with inclusive = false could be used .
  • A regular screen can never be the root right now. This is an issue if we'd want to properly support deep links in other app's task stack. Building a synthetic back stack like we do right now is only the recommended/expected behavior for deep links in our own back stack. However if another app launches a deep link in their own task, it's expected that only the top level screen is on the back stack. That behavior is a lot less annoying, but currently can't be supported in Khonshu.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions