Skip to content

[go_router] #127016 preserved route name case when caching _nameToPath #4196

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

Merged
merged 9 commits into from
Jun 13, 2023

Conversation

Khalidm98
Copy link
Contributor

preserved route name case when caching _nameToPath by not using toLowerCase()

Related issue:
#127016

@Khalidm98 Khalidm98 requested a review from chunhtai as a code owner June 12, 2023 14:02
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

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.

Can you write a test to make sure we don't break it accidentally?

Comment on lines 3 to 4
- Preserves route name case when caching `_nameToPath` by not using `toLowerCase()`.<br>
this is useful to make route names case sensitive
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Preserves route name case when caching `_nameToPath` by not using `toLowerCase()`.<br>
this is useful to make route names case sensitive
- Makes namedLocation and route name related APIs case sensitive.

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, will write the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the test and modified the changelog as suggested.
Do you have any other comments or suggestions in mind?
Thanks ✌️

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, some suggestions on test

);

// go to ScreenB
navKey.currentContext!.goNamed('name');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
navKey.currentContext!.goNamed('name');
router.goNamed('name');


// go to ScreenB
navKey.currentContext!.goNamed('name');
assert(GoRouter.of(navKey.currentContext!).location == '/path');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert(GoRouter.of(navKey.currentContext!).location == '/path');
expect(find.byType(ScreenB), findsOneWidget);

assert(GoRouter.of(navKey.currentContext!).location == '/path');

// go to ScreenA
navKey.currentContext!.goNamed('Name');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
navKey.currentContext!.goNamed('Name');
router.goNamed('Name');


// go to ScreenA
navKey.currentContext!.goNamed('Name');
assert(GoRouter.of(navKey.currentContext!).location == '/');
Copy link
Contributor

Choose a reason for hiding this comment

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

expect(find.byType(ScreenA), findsOneWidget);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestions are applied, thanks ✌️

@chunhtai
Copy link
Contributor

Looks like some other tests are failing

@Khalidm98
Copy link
Contributor Author

Khalidm98 commented Jun 13, 2023

Looks like some other tests are failing

@chunhtai Tests are fixed now

@chunhtai chunhtai requested a review from hannah-hyj June 13, 2023 15:30
Copy link
Member

@hannah-hyj hannah-hyj left a comment

Choose a reason for hiding this comment

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

LGTM

@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 13, 2023
@auto-submit auto-submit bot merged commit 1dad759 into flutter:main Jun 13, 2023
@Khalidm98
Copy link
Contributor Author

@chunhtai , @Hangyujin
look like auto-submit failed with 401, can you give it a look? or am I missing something?

@chunhtai
Copy link
Contributor

The ci was acting weird, I think the action item is on the flutter team to fix it.

@Khalidm98
Copy link
Contributor Author

Do they know about the issue? or do we need to raise a flag somehow?

@Khalidm98
Copy link
Contributor Author

It is released now, thank guys for your cooperation ✌️

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 14, 2023
LongCatIsLooong pushed a commit to flutter/flutter that referenced this pull request Jun 16, 2023
flutter/packages@0507297...f9314a3

2023-06-14 stuartmorgan@google.com [tool] Support running main.dart
(flutter/packages#4208)
2023-06-13 stuartmorgan@google.com [tool] Allow running from anywhere
(flutter/packages#4199)
2023-06-13 62033170+Khalidm98@users.noreply.github.com [go_router]
#127016 preserved route name case when caching `_nameToPath`
(flutter/packages#4196)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert
to ensure that a human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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 needs tests p: go_router
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants