auto_route_library icon indicating copy to clipboard operation
auto_route_library copied to clipboard

Duplicated page are not saved during state restoration

Open BarashkovaElena opened this issue 6 months ago • 0 comments

I have an issue with restoring navigation state. In my test app there is a couple of pages. Sign-up 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. Call context.router.push(const ExternalRoute());
  5. Call context.router.push(const ExternalRoute());
  6. Put the app to background.
  7. Restore the app. Expected result: 3 instances of ExternalRoute are restored. Like /external-route/external-route/external-route. So that back button returns to the second ExternalRoute, then to the first ExternalRoute, then closes the app. Actual result: back button closes ExternalRoute, SignUpRoute shows.

BarashkovaElena avatar Aug 19 '24 13:08 BarashkovaElena