Milad-Akarie / auto_route_library

Flutter route generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Back button or pop does not remove my route from the stack

neckaros opened this issue · comments

Summary
When i go back (hardware button) the route remain in the tree even if no longer visible

Router:

@MaterialAutoRouter(
  replaceInRouteName: 'Page,Route',
  routes: <AutoRoute>[
    AutoRoute(path: '/login', page: LoginPage, initial: true),
    AutoRoute(
      path: '',
      page: SelectServerPage,
      guards: [AuthGuard],
    ),
    AutoRoute(
      path: 'server/:serverId',
      page: ServerPage,
      guards: [AuthGuard],
      children: [
        AutoRoute(
          path: '',
          initial: true,
          page: LibrarySelectPage,
        ),
        AutoRoute(
          path: 'library/:libraryId',
          page: LibraryPage,
          guards: [AuthGuard],
          children: [
            AutoRoute(
              path: 'dashboard',
              initial: true,
              page: ShowDashboardPage,
            ),
          ],
        ),
      ],
    ),
  ],
)
class $AppRouter {}

Action:
once logged i'm routed to the SelectServerPage.
When i select a server i am redirected to ServerPage which initiate a riverpod provider with the server matching the serverId and display AutoRouter() once it's ready
This works well and i see my LibrarySelectPage.

the issue is that if i go back from here i correctly see the SelectServerPage, but the LibrarySelectPage remains in the tree (i see it in the Widget inspector and when i click the ok --TV emulator-- button it activate the focused item in the LibrarySelectPage)

issue:
I expect page poped to no longer be in the Tree. I'm i wrong?

@neckaros any idea how I can reproduce this?

@neckaros any idea how I can reproduce this?

Yes sorry this issue is not really helpful like this.

From my tests it comes from the use of nested router. I will try to do a minimal repo to reproduce.

As a workaround I don't use nested route anymore but I have to verify that my riverpod are initialized on every page

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions