-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[go_router_builder] Add support for relative routes #8476
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
base: main
Are you sure you want to change the base?
Conversation
- Adds `TypedRelativeGoRoute`
…for `concatenateUris`
…ly use dependency_overrides to take local go_router
…Route's extension
@chunhtai same issue I asked in the old PR. The test will fail without the temp dependency_overrides. Should I make a PR that contains only the |
final GoRouter _router = GoRouter( | ||
routes: $appRoutes, | ||
); | ||
const TypedRelativeGoRoute<DetailsRoute> detailRoute = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is different between using this vs a regular TypedGoRoute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example I gave isn't clearly explaining the purpose. Let me update this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still can't see the difference. Is this a way to reuse the typedGoRoute in multiple places in the routing tree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Without this you'd have to define routes like
SettingsFromHomeRoute
SettingsFromDashboardRoute
And those routes all build (or build page) the same screen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this makes sense. I will take another look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just updated the example
final GoRouter _router = GoRouter( | ||
routes: $appRoutes, | ||
); | ||
const TypedRelativeGoRoute<DetailsRoute> detailRoute = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment #8476 (comment)
I also would love this. |
Just did another merge conflict. Is there a better way to avoid conflict in the changelog file? |
@chunhtai is there any way you could step back in and help us get this merged? It's super high value for us and it looks like it has been done for a couple of months and just stuck in a merge conflict loop waiting for your approval and merge. |
I am working on an updated workflow for flutter/packages to remove the pain point of the changelog and version merge conflicts, hoping to get that out sooner rather than later. I can help shepherd this in, but please do update the pubspec to match what you have indicated as the new version in the changelog, that seems to be have been omitted. CI is also failing, can you take a look? |
@hannah-hyj I noticed you mentioned in #8665 that PRs should be split between go_router and go_router_builder. Is that not relevant here? |
cc @ThangVuNguyenViet for the pubspce and CI issues mentioned |
Hi there @ThangVuNguyenViet, thanks much for contributing! Are you still able to work on this to complete the few things mentioned? |
hey @mit-mit I don't think what she mentioned was relevant |
Hey @ThangVuNguyenViet I'd love to help you get this in. Currently there are several failing tests, can you take a look? |
@Piinks there seems to be a new convention for go_router_builder, which requires |
There are lots of breaking changes in #9277 that results in this test run failure. Specifically it throws After carefully inspected the changes, I've removed 1 breaking change that that PR made, which is the adding of
I'm removing that set of routing methods in the upcoming commits, and adapting the generation of |
…ator to use mixin instead of extension. Update tests to use appropriate mixins
btw I am unable to run the |
…s much as possible. Add case sensitive support. Fix failing tests
@Piinks please assist me on the breaking change. I think removing that part was right, but if you tell me that wasn't the right direction, I'm happy to bring it back and make changes as needed |
I don't think undoing the other change as part of this one is the right course of action. That change has already been published, and undoing it would be another breaking change. |
There's a failure here that can probably be fixed with a merge/rebase. |
Thank you for all the work you've put into this PR. To help this feature move forward, I have opened two new PRs (#9732, #9749). Please let me know if you have any feedback or see any issues with this approach. For testing, add the following to dependencies:
go_router:
git:
url: https://github.com/LukasMirbt/packages.git
ref: relative-routes
path: packages/go_router
dev_dependencies:
go_router_builder:
git:
url: https://github.com/LukasMirbt/packages.git
ref: relative-routes
path: packages/go_router_builder |
Is it this fork? I want to use it until this PR has been merged. |
@abdullahalamodi you should've used the |
This PR is a 2nd part of #6825 to fully resolves flutter/flutter#108177, which allow users to use
TypedRelativeGoRoute
to construct the route relatively.This is a continuation of #7174
Example:
Basically the added TypedRelativeGoRoute allows us to construct the route tree above. If we replace it with the existing
TypedGoRoute
it will declare multiple extensions of a same thing and produce build time errorPre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.