Skip to content

[go_router] Adds caseSensitive to GoRoute #8992

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

Conversation

ValentinVignal
Copy link
Contributor

@ValentinVignal ValentinVignal commented Apr 3, 2025

Fixes flutter/flutter#162487
Fixes flutter/flutter#166576

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@@ -275,6 +275,7 @@ class GoRoute extends RouteBase {
super.parentNavigatorKey,
super.redirect,
this.onExit,
this.caseSensitive = false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chunhtai, from your comment flutter/flutter#162487 (comment),

based on https://www.w3.org/TR/WD-html40-970708/htmlweb.html, the URL should be case sensitive

I prefer to set the default to `true, ' but that would be a breaking change. I'm fine writing a migration doc

What do you prefer me to do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should probably default it to true to provide the correct behavior by default, but yeah we should bump major version and a breaking change doc if we do that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok ! Will do !

@ValentinVignal
Copy link
Contributor Author

Converting as draft while the design doc is being written and the code updated

@ValentinVignal
Copy link
Contributor Author

@ValentinVignal ValentinVignal marked this pull request as ready for review April 4, 2025 12:18
@ValentinVignal
Copy link
Contributor Author

@chunhtai The URL is now case sensitive by default

sfshaza2 pushed a commit to flutter/website that referenced this pull request Apr 7, 2025
Adds the migration guide for go_router v15 (See
flutter/packages#8992, and more precisely
flutter/packages#8992 (comment))

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.
@ValentinVignal
Copy link
Contributor Author

The migration guide has been merged and is now available at the go url

@ValentinVignal ValentinVignal force-pushed the go-router/Add-case-sensitive-to-go-route branch from e4aff26 to ca1432f Compare April 8, 2025 15:03
@@ -218,7 +218,17 @@ abstract class RouteMatchBase with Diagnosticable {
final String newMatchedLocation =
concatenatePaths(matchedLocation, pathLoc);
final String newMatchedPath = concatenatePaths(matchedPath, route.path);
if (newMatchedLocation.toLowerCase() == uri.path.toLowerCase()) {

final String caseSensitiveNewMatchedLocation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new name is more confusing than the old name, because it can contains case insensitive string in the else case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, What do you think of newMatchedLocationToCompare and uriPathToCompare ? I added them in Add better name and documentation

@@ -437,6 +438,9 @@ class GoRoute extends RouteBase {
/// ```
final ExitCallback? onExit;

/// Whether the path is case sensitive or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more description? perhaps with some example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added more in Add better name and documentation, tell me if you need more

@ValentinVignal ValentinVignal requested a review from chunhtai April 15, 2025 09:53
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing this!

@ValentinVignal ValentinVignal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2025
Copy link
Contributor

auto-submit bot commented Apr 16, 2025

autosubmit label was removed for flutter/packages/8992, because - The status or check suite Mac_arm64 custom_package_tests stable has failed. Please fix the issues identified (or deflake) before re-applying this label.

@ValentinVignal ValentinVignal force-pushed the go-router/Add-case-sensitive-to-go-route branch from 48ba286 to 12f0136 Compare April 16, 2025 06:43
@ValentinVignal ValentinVignal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: go_router
Projects
None yet
2 participants