-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Browser should store up-to-date state in browser history entry when using router #80546
Comments
@mdebbar does the new behavior looks good to you? In the real world app, if they stores scroll position in the RouteInformation.state, when they go to a different page and press browser back button. The should see the latest scroll position instead of the scroll position when they first enter the page. |
@chunhtai yeah, that makes sense. Is this going to require a new platform message to replace state? |
Or we can extend our existing platform method routerUpdated to take an additional flag to represent whether it is a replace or push. Is there a preference? |
I'm assuming you mean |
@chunhtai the PR for this has broken back button navigation on all of Routemaster's example apps. In Chrome, the back button is no longer enabled after any navigation. I haven't had time to check what's going on yet, but might be worth reverting? |
@chunhtai also checked beamer's examples, and it's the same - back button doesn't function. Examples work fine with current Flutter Dev 2.5.0-5.0.pre. cc @slovnicki |
Hi @tomgilder, I tried running your app, and it keeps spliting out
which points to this line https://github.com/flutter/engine/blob/95c7ed2b5d7865c8e6ac07ae76020bf4f1a4d349/lib/web_ui/lib/src/engine/window.dart#L173 I tried example in https://medium.com/flutter/learning-flutters-new-navigation-and-routing-system-7c9068155ade, the backbutton works fine there |
The root cause is this flutter/engine@596571bcd1 |
Filed #87823 |
I just want to add that this example is working fine probably because @override
RouteInformation restoreRouteInformation(BookRoutePath path) {
if (path.isHomePage) {
return RouteInformation(location: '/');
}
if (path.isDetailsPage) {
return RouteInformation(location: '/book/${path.id}');
}
return null;
} |
@slovnicki That is right, It is fixed in the engine side. Right now, just need to wait for the engine roll |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
a spin off of the comment #65777 (comment)
Currently the browser history does not update the current state even if router report different state as long as the url does not change. We should makes sure it will update the current state when that happens.
For example if the router sends the following RouteInformation updates:
The browser history should store the following entries:
RouteInformation(location: '/user', state: 'state3') -> RouteInformation(location: 'setting', state: 'state4')
But current implementation of browser history instead store the following:
RouteInformation(location: '/user', state: 'state1') -> RouteInformation(location: 'setting', state: 'state4')
Repro
steps:
expect: the counter stay the same
actual: counter is reseted to 0
The text was updated successfully, but these errors were encountered: