Commit 2a7df7a
authored
[go_router] fix Popping state and re-rendering scaffold at the same time doesn't update the URL on web [new] (#8352)
> 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.
> 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))
```1 parent 93e91f3 commit 2a7df7a
File tree
4 files changed
+32
-2
lines changed- packages/go_router
- lib/src
- test
4 files changed
+32
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | | - | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
499 | 502 | | |
500 | 503 | | |
501 | 504 | | |
502 | 505 | | |
503 | 506 | | |
504 | 507 | | |
| 508 | + | |
505 | 509 | | |
506 | 510 | | |
507 | 511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
81 | 103 | | |
82 | 104 | | |
83 | 105 | | |
| |||
0 commit comments