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] Use the correct configuration to build the state passed to the onExit #6623

Conversation

ValentinVignal
Copy link
Contributor

@ValentinVignal ValentinVignal commented Apr 29, 2024

While working on #6614, I notice some issues with the state that is given to the onExit (see the run https://github.com/flutter/packages/pull/6614/checks?check_run_id=24284539541)

This PR uses the correct configuration to build the state and pass it to the onExit

Pre-launch Checklist

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

@@ -233,7 +233,7 @@ class GoRouterDelegate extends RouterDelegate<RouteMatchList>
exitingMatches.length - 1,
context: navigatorContext,
matches: exitingMatches,
configuration: configuration,
// configuration: configuration,
Copy link
Contributor

Choose a reason for hiding this comment

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

?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh my ! Sorry about that. I removed it in refactor: Remove commented code

);
}
return SynchronousFuture<bool>(false);
}

final FutureOr<bool> exitFuture = goRoute.onExit!(
context,
match.buildState(_configuration, configuration),
match.buildState(_configuration, currentConfiguration),
Copy link
Contributor

Choose a reason for hiding this comment

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

so the difference is whether we use the new RouteMatchList after the change vs old RouteMatchList?

I think for redirect we use the new RouteMatchList. it seems to previous implementation is more inline with the redirect API no?

Copy link
Contributor

Choose a reason for hiding this comment

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

I maybe wrong here. do you have use case that using the old routematchList is more preferred? on the other hand, I plan to redesign redirect, so maybe we should just provide both before and after?

Copy link
Contributor Author

@ValentinVignal ValentinVignal Apr 30, 2024

Choose a reason for hiding this comment

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

Yes, I found one in #6614. I was making go_router_builder use onExit in some tests failed https://github.com/flutter/packages/pull/6614/checks?check_run_id=24284539541.

The issue was when using .go(). The onExit had the state of the new page, not the previous page.

The test I wrote in this PR

'It should provide the correct path parameters to the onExit callback during a go'

fails without my changes.

On the other hand, I plan to redesign redirect, so maybe we should just provide both before and after?

Sure, do you want me to change something then?

Copy link
Contributor

Choose a reason for hiding this comment

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

I will need to redesign the onExit in the future. It also has issue with popscope and cupertinobackswipe. Thing may become a lot different after I resolve all these issues.

After thinking about it more, I think we should just keep it simple for now. I think what you have is fine.

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

@chunhtai chunhtai requested a review from hannah-hyj May 2, 2024 21:37
…ct-configuration-in-on-exit

# Conflicts:
#	packages/go_router/CHANGELOG.md
#	packages/go_router/pubspec.yaml
@ValentinVignal
Copy link
Contributor Author

@hangyujin Is there something I need to do about this PR ?

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 May 14, 2024
@auto-submit auto-submit bot merged commit fd714bd into flutter:main May 14, 2024
74 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 14, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 14, 2024
flutter/packages@1412041...fd714bd

2024-05-14 [email protected] [go_router] Use the correct configuration to build the state passed to the `onExit` (flutter/packages#6623)

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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
…o the `onExit` (flutter#6623)

While working on flutter#6614, I notice some issues with the state that is given to the `onExit` (see the run https://github.com/flutter/packages/pull/6614/checks?check_run_id=24284539541)

This PR uses the correct configuration to build the state and pass it to the `onExit`
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
…o the `onExit` (flutter#6623)

While working on flutter#6614, I notice some issues with the state that is given to the `onExit` (see the run https://github.com/flutter/packages/pull/6614/checks?check_run_id=24284539541)

This PR uses the correct configuration to build the state and pass it to the `onExit`
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
Development

Successfully merging this pull request may close these issues.

3 participants