Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making navigation asynchronous #183

Open
ryanmoelter opened this issue Jul 10, 2021 · 0 comments
Open

Consider making navigation asynchronous #183

ryanmoelter opened this issue Jul 10, 2021 · 0 comments

Comments

@ryanmoelter
Copy link
Contributor

Background

Navigation, as it stands today, has a few weird edge cases.

  • What happens if you navigate before navigation is finished, e.g. in onShow()? Currently magellan breaks in non-obvious ways ("Cannot pause() from a state that is not Resumed: MyStep is Shown").
  • Navigating from the previous Step's shownScope causes the scope we're operating in to be disposed before the navigation is done. This has caused problems with Rx in the past, and will probably cause problems with coroutines in the future.

Acceptance criteria

  • Navigation is done in the navigator's Created coroutine scope
  • Navigator uses a messageQueue, and any navigation started during another navigation event is postponed until the current navigation event is done.

Misc thoughts and unsolved questions

  • Should navigate be a suspending function or return immediately?
    • Case: Navigation is started in Step (scoped or no)
      • Suspending function doesn't make sense, since the scope will be disposed halfway through the navigation event
      • Return immediately makes sense
    • Case: Navigation is started in Journey (scoped or no)
      • Could be helpful to know when the navigation event ends, so we can e.g. update state machine accordingly
      • Return immediately could make sense for simple cases
  • Should navigation be run on the main thread?
    • It's probably technically better to run it on a background thread, but might not be worth the complexity
  • We probably shouldn't make navigation blocking anymore (non-suspending), since it would only sometimes be able to do so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant