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
[go_router] 5.2.0 push
doesn't update the URL anymore.
#115962
Comments
Triage reportI can reproduce this issue. I can also confirm that the URL does indeed change in Code Sample (Same as OP)import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(const MyApp());
}
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const Home(),
),
GoRoute(
path: '/settings',
builder: (context, state) => const Settings(),
),
],
);
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: router,
);
}
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
router.push('/settings');
},
child: const Text('Settings'),
),
),
);
}
}
class Settings extends StatelessWidget {
const Settings({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Settings'),
),
);
}
} |
Yeah I'm facing the same issue when pushing the route URl is not updating. In mobile app using context.go going to the route but once I back to previous route then I can't longer go to same route again. |
context.pop() also doesn't update URL. Maybe it's a consequence, maybe it's the same root cause. |
It's related to the changes in Uri get location =>
_matches.isEmpty ? Uri() : Uri.parse(_matches.last.fullUriString); But in 5.2.0, location was replaced with an uri field ( |
Reading the discussion in #99112 I realise there are more complexity to consider, and I sort of understand the reasoning around that pushed routes perhaps doesn't justify a location change. However, I think pop is a bit different, since that operation is often performed indirectly via BackButtons etc (perhaps mostly mobile though, but perhaps not only), and it's performed for both pushed and "go:ed" routes. Perhaps the |
448: Revert "chore(deps): bump go_router from 5.1.5 to 5.2.0" r=da-kami a=da-kami Reverts #422 fixes #441 Apparently we hit a regression bug that was already reported: flutter/flutter#115962 (comment) Note: I did go through the changelog before merging this and I did not see any indicator that we would run into trouble. Reverting for now, as there is no solution for `0.5.2` reported yet. Note: Before I found the regression I actually gave replacing `/` with a specific `/wallet` route (and setting `/wallet` as initial route) a try, because in `/cfd-trading` and it's subroutes we did not have this problem even with `0.5.2`. But I experienced the same behavior. Co-authored-by: Daniel Karzel <D.Karzel@gmail.com>
@chunhtai may i know any status update or any schedule plan about this issue? |
I plan to work on this soon. |
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 |
Steps to Reproduce
flutter run
on the code sample (see "Code sample" section below)go_router
5.2.0Expected results:
I expect the URL to change
Actual results:
The URL didn't change
The issue doesn't happen in the previous version (5.1.10) so I believe this was introduced in flutter/packages#2786
I don't know if this is related to #99112 (comment) which plans to remove imperative methods. But since I didn't see anything in the changelogs or documentation, I'm assuming this is a regression.
Code sample
Or you can checkout https://github.com/ValentinVignal/flutter_app_stable/tree/go-router/push-no-url-change
Logs
Videos
Screen.Recording.2022-11-24.at.10.20.44.AM.mov
Screen.Recording.2022-11-24.at.10.17.18.AM.mov
The text was updated successfully, but these errors were encountered: