Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chunhtai committed May 17, 2024
1 parent 757807e commit d4c4382
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 1 addition & 7 deletions packages/go_router/lib/src/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1136,13 +1136,7 @@ class StatefulNavigationShell extends StatefulWidget {
final GoRoute route = branch.defaultRoute!;
final List<String> parameters = <String>[];
patternToRegExp(route.path, parameters);
assert(
parameters.isEmpty,
'The first route in the branch contains parameter[s] $parameters. '
'The goBranch cannot infer its location string because of this. '
'Please provide an initialLocation to the StatefulShellBranch at '
'the index $index.',
);
assert(parameters.isEmpty);
final String fullPath = _router.configuration.locationForRoute(route)!;
return patternToPath(
fullPath, shellRouteContext.routerState.pathParameters);
Expand Down
5 changes: 2 additions & 3 deletions packages/go_router/test/go_router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3958,7 +3958,7 @@ void main() {

testWidgets(
'Navigates to correct nested navigation tree in StatefulShellRoute '
'and maintains state', (WidgetTester tester) async {
'and maintains path parameters', (WidgetTester tester) async {
StatefulNavigationShell? routeState;

final List<RouteBase> routes = <RouteBase>[
Expand Down Expand Up @@ -3992,8 +3992,7 @@ void main() {
])
];

final GoRouter router =
await createRouter(routes, tester, initialLocation: '/123/a');
await createRouter(routes, tester, initialLocation: '/123/a');
expect(find.text('a id is 123'), findsOneWidget);

routeState!.goBranch(1);
Expand Down

0 comments on commit d4c4382

Please sign in to comment.