You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue and conversation follows from Issue #1207. As a reference, please see PR #1836 as I'll be referring to this refactored web_demo to use as an example.
Having reviewed the issue listed above, I can understand and appreciate the complexity for both web and mobile routing. However, it seems that web routing may require additional work and consideration.
Summary
AutoLeadingButton via AutoRouter.of(context).popTop() or AutoRouter.of(context).pop() does not navigate to previous route with 2 or more in the stack (be they in the same or sub routers)
Reproduce Steps
Consider the your example (with my rework) in the following discussion.
Perform the following steps to highlight 2 issues:
Launch web_demo (assuming fresh launch, you are navigated to /#/login)
Note: the absence of a visible AutoLeadingButton action, as expected.
Note 2: let's ignore the addition pop buttons for now.
Click Navigate to user/2 button (redirect to /#/user/2 as expected)
Note: the presence of AutoLeadingButton action, as expected.
Issue 1
Click on leading action AutoLeadingButton back arrow, observe no change.
Click leading action Pop button, observe no change.
Note: printRouterStack shows 2 active routes (MainWebRoute, and UserRoute) but also pop() returns true. This value originates from UserRoute.popTop() calling Navigator.maybePop() (with RoutePopDisposition.doNotPop)which returns true, but no change is observed nor route popped.
The leading actions Pop until root and Force pop correctly pop the current router (UserRoute) from the stack as expected, going back to MainWebRoute with no AutoLeadingButton arrow visible, as expected.
(following from step 3) Click on Posts -> action, this navigates to /#/verify as per the Verify Guard for sub-router UserRoute)
Note: Current stack now shows (MainWebRoute, UserRoute, VerifyRoute respectively)
Issue 2
Click on leading action AutoLeadingButton back arrow, pops correctly and returns to UserRoute (on page /#/user/2 with RoutePopDisposition.pop)
Note the presence of AutoLeadingButton, clicking back which fails to pop the current route UserRoute. In Navigator.maybePop(), several recursive calls are made:
UserProfileRoute with RoutePopDisposition.bubble, return false.
Next, UserRoute with RoutePopDisposition.doNotPop, returns true.
Note however we still have MainWebRoute in the stack, which cannot be returned to here via conventional pop() with current router or root (AutoRouter.of(context).root) router. To pop, we must either call leading actions Pop until root or Force pop. Both are unexpected in this simple navigational requirement.
Comments
I've grouped these issues together as I believe they stem from the same root cause - admittedly I haven't dived into the mechanics just yet.
Impact
This significantly affects navigation for web apps, making navigation via URL or in-app stack navigation problematic and inconsistent.
The text was updated successfully, but these errors were encountered:
Hi Milad, thanks for your awesome work.
This issue and conversation follows from Issue #1207. As a reference, please see PR #1836 as I'll be referring to this refactored web_demo to use as an example.
Having reviewed the issue listed above, I can understand and appreciate the complexity for both web and mobile routing. However, it seems that web routing may require additional work and consideration.
Summary
AutoLeadingButton
viaAutoRouter.of(context).popTop()
orAutoRouter.of(context).pop()
does not navigate to previous route with 2 or more in the stack (be they in the same or sub routers)Reproduce Steps
Consider the your example (with my rework) in the following discussion.
Perform the following steps to highlight 2 issues:
/#/login
)/
as per AppRouter.onNavigation guard)AutoLeadingButton
action, as expected./#/user/2
as expected)AutoLeadingButton
action, as expected.AutoLeadingButton
back arrow, observe no change.printRouterStack
shows 2 active routes (MainWebRoute
, andUserRoute
) but alsopop()
returns true. This value originates from UserRoute.popTop() calling Navigator.maybePop() (withRoutePopDisposition.doNotPop
)which returns true, but no change is observed nor route popped.UserRoute
) from the stack as expected, going back toMainWebRoute
with noAutoLeadingButton
arrow visible, as expected./#/verify
as per the Verify Guard for sub-routerUserRoute
)MainWebRoute
,UserRoute
,VerifyRoute
respectively)AutoLeadingButton
back arrow, pops correctly and returns toUserRoute
(on page/#/user/2
withRoutePopDisposition.pop
)AutoLeadingButton
, clicking back which fails to pop the current routeUserRoute
. In Navigator.maybePop(), several recursive calls are made:UserProfileRoute
withRoutePopDisposition.bubble
, return false.UserRoute
withRoutePopDisposition.doNotPop
, returns true.MainWebRoute
in the stack, which cannot be returned to here via conventionalpop()
with current router or root (AutoRouter.of(context).root
) router. To pop, we must either call leading actions Pop until root or Force pop. Both are unexpected in this simple navigational requirement.Comments
I've grouped these issues together as I believe they stem from the same root cause - admittedly I haven't dived into the mechanics just yet.
Impact
This significantly affects navigation for web apps, making navigation via URL or in-app stack navigation problematic and inconsistent.
The text was updated successfully, but these errors were encountered: