-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Allow empty paths without making them initial? #1915
Comments
Maybe this is a better example:
Due to the fact that the |
@Milad-Akarie sorry for tagging you but I really was wondering if there is a solution to this so the empty path is not automatically the initial path? |
Hey @JonasJW I just wanted to take a look at the possibilities before I reply, they way RouteMatcher works this might need some work, it's not a bug it's just meant to work this way, so changing the implementation might take some work, besides, it might introduce breaking changes. from your usecase above I think what you need is active redirection based on user status, if that's the case what you need is to use AutoRoute.guarded(
page: HomeRoute.page,
path: '/home',
initial: true,
onNavigation: (resolver,_){
if(user != null){
resolver.next();
}else{
resolver.redirect(LoginRoute(noResult: resolver.next));
}
},
) |
@Milad-Akarie thanks for the clarification! I don't think the AutoRouteGuard approach would work in my case because I want users to be allowed to skip the login step, so even unauthenticated users should be able to navigate to the HomePage. It should just show different initial routes to ask not logged-in users to log in or skip and go to HomePage, while for logged-in users, start directly at the HomePage. However, I found that in my use case a simple RedirectionRoute does the job
Thanks for your help! |
Take this route as an example
The
ContentRoute
has anAutoTabsRouter
that renders the routesRoutineListRoute
andProgramListRoute
.I would like to set the path of
ContentRoute
to empty, so the paths/routines
and/programs
lead to the related tabs. However, I want to have theHomeRoute
as the initial route.It seems, leaving a path empty means it's automatically the initial route, even when having other routes marked as initial.
I would like that the path
/
leads toHomeRoute
but it always leads toRoutineListRoute
. Only/routines
should lead toRoutineListRoute
, not/
.The text was updated successfully, but these errors were encountered: