Skip to content

Conversation

@ahyangnb
Copy link
Contributor

@ahyangnb ahyangnb commented Dec 28, 2024

the old pr #6953

Change the 3 files of lib and add a example, because issue flutter/flutter#150312

The reason for the issue is when call counterStream.increment(); will notify notifyListeners() of StreamListener, and finally affect _handleRouteInformationProviderNotification of _RouterState in packages/flutter/lib/src/widgets/router.dart.

When pop should not call _handleRouteInformationProviderNotification otherwise will be path wrong.
because the value of GoRouteInformationProvider is not the latest.

Solution:

always make the value of GoRouteInformationProvider knew the latest RouteInformation[but not to do notifyListeners()].

i don't know if adding pop to NavigatingType is reasonable, if any place needs to be changed please tell me.

Result:

After changed, the issue been solved and all the others pop not be affect such as drawer/dialog/bottomsheet, See the video below.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I linked to at least one issue that this PR fixes in the description above.

flutter/flutter#150312

exempt from version changes

this PR is exempt from CHANGELOG changes.

  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.

this PR is test-exempt.

  • All existing and new tests are passing.

the go_route_test.dart will error if testWidgets('throw if redirect to itself')[I have this problem when I pull the online branch. it's not relate this PR, All of the others test success, So I view this as all test cases successfully passing.]

Exception has occurred.
_AssertionError ('package:go_router/src/parser.dart': Failed assertion: line 110 pos 18: '!matchList.last.route.redirectOnly': A redirect-only route must redirect to location different from itself.
 The offending route: GoRoute#0ae4e(name: null, path: "route", Redirect Only))

@ahyangnb ahyangnb requested a review from chunhtai as a code owner December 28, 2024 07:57
@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, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

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. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@ahyangnb
Copy link
Contributor Author

example code:
packages/packages/go_router/example/lib/stream_listener_router.dart

which contain test pop the drawer/dialog/bottomsheet.

@ahyangnb ahyangnb changed the title [Go Router] fix Popping state and re-rendering scaffold at the same time doesn't update the URL on web [new] [go_router] fix Popping state and re-rendering scaffold at the same time doesn't update the URL on web [new] Dec 28, 2024
@ahyangnb
Copy link
Contributor Author

after_changed

after_changed.MP4

@ahyangnb
Copy link
Contributor Author

before_change

before_change.MP4

@ahyangnb
Copy link
Contributor Author

ahyangnb commented Jan 9, 2025

@chunhtai , it's already been updated.

@ahyangnb
Copy link
Contributor Author

The unit test related to this issue has already been committed.

@chunhtai chunhtai self-requested a review January 23, 2025 22:54
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.

besides the unaddressed comment, this change LGTM

@ahyangnb ahyangnb requested a review from hannah-hyj May 13, 2025 07:04
@hannah-hyj
Copy link
Member

LGTM with some nit comments

@ahyangnb
Copy link
Contributor Author

ahyangnb commented Jun 9, 2025

okay, it's all updated

@chunhtai @hannah-hyj

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

@ahyangnb
Copy link
Contributor Author

how do we makes the pr as merged?

@Piinks
Copy link
Contributor

Piinks commented Jun 18, 2025

Hey @ahyangnb, updating the merge conflict here should put this in a mergable state so we can finally land it. 🎊

@Piinks
Copy link
Contributor

Piinks commented Jun 18, 2025

Let me see if I can update it so we can get this merged

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 18, 2025
@auto-submit auto-submit bot merged commit 2a7df7a into flutter:main Jun 18, 2025
78 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 19, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jun 19, 2025
flutter/packages@715a0a5...0ec4053

2025-06-19 [email protected] Roll Flutter from
8303a96 to 85a9b4f (93 revisions) (flutter/packages#9457)
2025-06-19 [email protected] [go_router]
Update sype safe routing topic to use mixin from go_router_builder 3.0.0
(flutter/packages#9422)
2025-06-19 [email protected] [go_router] fix:
PopScope.onPopInvokedWithResult not called in branch routes
(flutter/packages#9245)
2025-06-18 [email protected] [pigeon]
Create a message call free InstanceManager when running unit tests
(flutter/packages#9395)
2025-06-18 [email protected] [go_router] Use
library prefix for meta (flutter/packages#9434)
2025-06-18 [email protected] [go_router] fix
Popping state and re-rendering scaffold at the same time doesn't update
the URL on web [new] (flutter/packages#8352)
2025-06-18 [email protected] [camera_avfoundation] Fix
incorrect types in image stream events (flutter/packages#9418)
2025-06-18 [email protected] [go_router_builder] Temporarily
restrict `build` (flutter/packages#9453)

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] 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
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…ime doesn't update the URL on web [new] (flutter#8352)

> the old pr flutter#6953

Change the 3 files of lib and add a example, because issue flutter/flutter#150312

The reason for the issue is when call `counterStream.increment();` will notify `notifyListeners()` of `StreamListener`, and finally affect `_handleRouteInformationProviderNotification` of` _RouterState` in `packages/flutter/lib/src/widgets/router.dart`.

When pop should not call `_handleRouteInformationProviderNotification` otherwise will be path wrong.
because the value of `GoRouteInformationProvider` is not the latest.

## Solution:
always make the value of `GoRouteInformationProvider` knew the latest `RouteInformation`[but not to do `notifyListeners()`].

i don't know if adding `pop` to `NavigatingType` is reasonable, if any place needs to be changed please tell me.

## Result:
After changed, the issue been solved and all the others pop not be affect such as drawer/dialog/bottomsheet, See the video below.

> flutter/flutter#150312
> exempt from version changes
> this PR is exempt from CHANGELOG changes.
> this PR is test-exempt.
> the `go_route_test.dart` will error if `testWidgets('throw if redirect to itself')`[I have this problem when I pull the online branch. it's not relate this PR, All of the others test success, So I view this as all test cases successfully passing.]
```
Exception has occurred.
_AssertionError ('package:go_router/src/parser.dart': Failed assertion: line 110 pos 18: '!matchList.last.route.redirectOnly': A redirect-only route must redirect to location different from itself.
 The offending route: GoRoute#0ae4e(name: null, path: "route", Redirect Only))
 ```
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
flutter/packages@715a0a5...0ec4053

2025-06-19 [email protected] Roll Flutter from
8303a96 to 85a9b4f (93 revisions) (flutter/packages#9457)
2025-06-19 [email protected] [go_router]
Update sype safe routing topic to use mixin from go_router_builder 3.0.0
(flutter/packages#9422)
2025-06-19 [email protected] [go_router] fix:
PopScope.onPopInvokedWithResult not called in branch routes
(flutter/packages#9245)
2025-06-18 [email protected] [pigeon]
Create a message call free InstanceManager when running unit tests
(flutter/packages#9395)
2025-06-18 [email protected] [go_router] Use
library prefix for meta (flutter/packages#9434)
2025-06-18 [email protected] [go_router] fix
Popping state and re-rendering scaffold at the same time doesn't update
the URL on web [new] (flutter/packages#8352)
2025-06-18 [email protected] [camera_avfoundation] Fix
incorrect types in image stream events (flutter/packages#9418)
2025-06-18 [email protected] [go_router_builder] Temporarily
restrict `build` (flutter/packages#9453)

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] 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
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…ime doesn't update the URL on web [new] (flutter#8352)

> the old pr flutter#6953

Change the 3 files of lib and add a example, because issue flutter/flutter#150312

The reason for the issue is when call `counterStream.increment();` will notify `notifyListeners()` of `StreamListener`, and finally affect `_handleRouteInformationProviderNotification` of` _RouterState` in `packages/flutter/lib/src/widgets/router.dart`.

When pop should not call `_handleRouteInformationProviderNotification` otherwise will be path wrong.
because the value of `GoRouteInformationProvider` is not the latest.

## Solution:
always make the value of `GoRouteInformationProvider` knew the latest `RouteInformation`[but not to do `notifyListeners()`].

i don't know if adding `pop` to `NavigatingType` is reasonable, if any place needs to be changed please tell me.

## Result:
After changed, the issue been solved and all the others pop not be affect such as drawer/dialog/bottomsheet, See the video below.

> flutter/flutter#150312
> exempt from version changes
> this PR is exempt from CHANGELOG changes.
> this PR is test-exempt.
> the `go_route_test.dart` will error if `testWidgets('throw if redirect to itself')`[I have this problem when I pull the online branch. it's not relate this PR, All of the others test success, So I view this as all test cases successfully passing.]
```
Exception has occurred.
_AssertionError ('package:go_router/src/parser.dart': Failed assertion: line 110 pos 18: '!matchList.last.route.redirectOnly': A redirect-only route must redirect to location different from itself.
 The offending route: GoRoute#0ae4e(name: null, path: "route", Redirect Only))
 ```
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.

4 participants