stacked icon indicating copy to clipboard operation
stacked copied to clipboard

[docs]: Looks like you're trying to navigate to a nested route without adding their parent to stack first

Open KhalilAmor opened this issue 2 years ago • 2 comments

Describe the missing piece of documentation

I couldn't find any documentation that discusses using sub-routes for web.

KhalilAmor avatar Aug 28 '23 14:08 KhalilAmor

Hi @KhalilAmor , I will try to add nested routes documentation as soon as possible.

ferrarafer avatar Sep 12 '23 14:09 ferrarafer

I had the same problem, it took me a while to understand how to solve this error. This happens if you are trying to route from one nested page to another in another branch of the navigation tree. For example considering the following the page structure:

    CustomRoute(
      page: MainView,  path: '/',
      children: [
        CustomRoute(page: HomeView, initial: true, path: 'home'),
        CustomRoute(page: WhoweareView, path: 'chisiamo'),
        CustomRoute(page: ExecutiveView, path: 'direttivo'),
        CustomRoute(page: StaffView, path: 'staff'),
        CustomRoute(page: DocumentsNavigation, path: 'documenti', children: [
          CustomRoute(page: DocumentsView, initial: true),
        ]),
        CustomRoute(page: EventsView, path: 'eventi'),
        CustomRoute(page: VolunteersView, path: 'volontariato'),
        CustomRoute(page: ContactsView, path: 'contatti', maintainState: false),
        CustomRoute(page: TeachersNavigation ,path: 'insegnanti', children: [
          CustomRoute(page: TeachersView,initial: true),
          CustomRoute(page: TeachersDetailsView),
        ]),
        CustomRoute(page: CoursesNavigation,path: 'corsi', children: [
          CustomRoute(page: CoursesView, initial: true),
          CustomRoute(page: CoursesDetailsView),
        ]),
        CustomRoute(page: PrivacyinfoView, path: 'privacy', maintainState: false),
        CustomRoute(page: CvVittorioParagalloView, path: 'cv-vittorio-paragallo', maintainState: false),
      ],

To navigate from DocumentsView to PrivacyinfoViewRoute:

final _routerService = locator<RouterService>();
_routerService.navigateTo(MainViewRoute(children: [PrivacyinfoViewRoute()]));

VittorioParagallo avatar Jan 05 '24 23:01 VittorioParagallo

Nested routes has been added.

FilledStacks avatar Oct 04 '24 10:10 FilledStacks