Skip to content
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

fix: GoRouter doesn't like subroutes for external links #5706

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/smooth_app/lib/pages/navigator/app_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,18 @@ class _SmoothGoRouter {
}
},
),
GoRoute(
path: _InternalAppRoutes.EXTERNAL_PAGE,
builder: (BuildContext context, GoRouterState state) {
return ExternalPage(path: state.uri.queryParameters['path']!);
},
),
GoRoute(
path: _InternalAppRoutes.SIGNUP_PAGE,
builder: (_, __) => const SignUpPage(),
)
],
),
GoRoute(
path: '/${_InternalAppRoutes.EXTERNAL_PAGE}/:page',
builder: (BuildContext context, GoRouterState state) {
return ExternalPage(path: state.pathParameters['page']!);
},
),
],
redirect: (BuildContext context, GoRouterState state) {
final String path = state.matchedLocation;
Expand Down Expand Up @@ -460,5 +460,5 @@ class AppRoutes {

// Open an external link (where path is relative to the OFF website)
static String EXTERNAL(String path) =>
'/${_InternalAppRoutes.EXTERNAL_PAGE}/?path=$path';
'/${_InternalAppRoutes.EXTERNAL_PAGE}/$path';
}