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

How to avoid opening initial page when restoring state #2039

Open
BarashkovaElena opened this issue Aug 19, 2024 · 0 comments
Open

How to avoid opening initial page when restoring state #2039

BarashkovaElena opened this issue Aug 19, 2024 · 0 comments

Comments

@BarashkovaElena
Copy link

I have an issue with restoring navigation state.
In my test app there is a couple of pages. Sign-in page is initial.

@AutoRouterConfig(replaceInRouteName: 'Screen|Page,Route')
class AppRouter extends RootStackRouter {
  @override
  List<AutoRoute> get routes => [
        AutoRoute(
          page: SignUpRoute.page,
          initial: true,
        ),
        AutoRoute(
          page: ExternalRoute.page,
        ),
}

Steps to reproduce the issue.

  1. Set "Don't keep activities" flag on Android device.
  2. Open the app.
  3. Call context.router.replace(const ExternalRoute());
  4. Note that the page of ExternalRoute opens (If you press back button at this point, it exits the app, because this page is now the only one in the stack.)
  5. Put the app to background.
  6. Restore the app.
    Expected result: ExternalRoute is restored. Back button closes the app, you cannot go back to SignInRoute.
    Actual result: ExternalRoute is restored, but back button leads to SignInRoute, which should not happen.
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

No branches or pull requests

1 participant