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

[go_router_builder] Add support for relative routes #7174

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add more concatenateUris test. Fix joining params
  • Loading branch information
ThangVuNguyenViet committed Jun 19, 2024
commit ccb38f92f15478dc9f26ed60a1d82385f0350169
2 changes: 1 addition & 1 deletion packages/go_router/lib/src/path_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ String concatenatePaths(String parentPath, String childPath) {
Uri concatenateUris(Uri parentUri, Uri childUri) {
// Merge query parameters from both Uris. We don't return an empty map to prevent trailing '?'.
final Map<String, dynamic>? newParameters =
parentUri.queryParameters.isNotEmpty &&
parentUri.queryParameters.isNotEmpty ||
childUri.queryParameters.isNotEmpty
? <String, dynamic>{
...parentUri.queryParameters,
Expand Down
4 changes: 4 additions & 0 deletions packages/go_router/test/path_utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ void main() {

verify('/a', 'b/c', '/a/b/c');
verify('/', 'b', '/b');

// Test with parameters
verify('/a?fid=f1', 'b/c', '/a/b/c?fid=f1');
verify('/a', 'b/c?pid=p2', '/a/b/c?pid=p2');
verify('/a?fid=f1', 'b/c?pid=p2', '/a/b/c?fid=f1&pid=p2');
});

Expand Down