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

Allows page removal that contains Localhistoryentry #134757

Merged
merged 3 commits into from
Sep 14, 2023

Conversation

chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Sep 14, 2023

fixes #97836
fixes #134752
fixes #118645

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • 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.
  • All existing and new tests are passing.

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

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: routes Navigator, Router, and related APIs. labels Sep 14, 2023
@@ -1832,14 +1832,6 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
];
}

@override
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking at the code, it looks like popscope/willpopscope are going through Navigator.maybePop mechanism and are still allowed to be popped through Navigator.pop. So it is not handle pop internally.

@@ -3268,6 +3272,20 @@ class _RouteEntry extends RouteTransitionRecord {
'This route cannot be marked for pop. Either a decision has already been '
'made or it does not require an explicit decision on how to transition out.',
);
// Remove state that prevents a pop, e.g. LocalHistoryEntry[s].
int attempt = 0;
while (route.willHandlePopInternally) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the other solutions I can think of would require adding new API and break other people, or messing with Navigator/Route class.

}(),
'Attempted to pop $route $kDebugPopAttemptLimit times, but still failed',
);
final bool popResult = route.didPop(result);
Copy link
Member

Choose a reason for hiding this comment

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

Wondering why we do this in the markForPop and not in the actual handlePop where the route is actually popped?

Also, should we be asserting somewhere that handlePop must actually return true if we're removing a page? This change basically disallows that a page-based route can veto its return, right?

Copy link
Member

Choose a reason for hiding this comment

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

Wondering if this can lead to strange animations: It will basically run route-internal pop animations (e.g. to close drawers) while the regular route pop-animation runs, no?

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to actually add new API to the route for this to tell it: "Hey, you have to go away, if you want to do some internal pops, do them, but after that you have to go away". This would basically leave the decision if it wants to pop drawers in an animated way while the whole route is popped to the route itself.

I would image that in most case where you remove a page with an open drawer you don't really want to run the drawer close animation while the page goes away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

handlePop

handlePop can be called as a result of various reason, either a navigator.pop or page update. If we handle it there, I would need to add a flag and drill it down from markForPop to handlePop which is not trivial.

should we be asserting somewhere that handlePop must actually return true

It is possible the handlePop is a result of Navigator.pop on a page-based route. so we can't assert it return true.

It will basically run route-internal pop animations (e.g. to close drawers) while the regular route pop-animation runs.

I don't have a counter argument to this, but if they want to do something special (if they really care) they should do it before they update the Navigator.pages.

Would it make sense to actually add new API to the route for this to tell it: "Hey, you have to go away, if you want to do some internal pops, do them, but after that you have to go away"

I have thought about adding something like void cleanUpInternalPopHandler() and asserts willHandlePopInternally to return false after that, but I figure this will be another breaking change to people and will increase complexity of Route class which is already very confusing with all the canpop, popDisposition, willhandlePop...etc.

I figure the current solution is a good enough solution that will likely solve most if not all use cases. Prior to this change, the page update will just be broken. So this will only be an improvement.

If they really want to customize how route is forced to be removed, we can always add the new API later and remove this while loop didPop.

Copy link
Member

@goderbauer goderbauer 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 added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 14, 2023
@auto-submit auto-submit bot merged commit 0e52194 into flutter:master Sep 14, 2023
65 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 15, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 15, 2023
flutter/flutter@58ba6c2...72b69f9

2023-09-15 polinach@google.com Date picker dialog state should dispose members. (flutter/flutter#134804)
2023-09-15 engine-flutter-autoroll@skia.org Roll Packages from 275b76c to bc8c2f2 (7 revisions) (flutter/flutter#134823)
2023-09-15 leroux_bruno@yahoo.fr Fix navigation rail hover misplaced when direction is RTL and extended is true (flutter/flutter#134815)
2023-09-15 k_hayashi@yumemi.co.jp Applied the logo to the Discord badge. (flutter/flutter#134339)
2023-09-15 sokolovskyi.konstantin@gmail.com Fix memory leak in ListWheelScrollView (flutter/flutter#134732)
2023-09-15 zanderso@users.noreply.github.com Move two tests on Pixel 7 from staging to prod (flutter/flutter#134784)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 683bca53d4d7 to 45bc4307cda3 (2 revisions) (flutter/flutter#134789)
2023-09-14 pavel.mazhnik@gmail.com [web] provide serviceWorkerVersion to the getNewServiceWorker function (flutter/flutter#131240)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3a3a2807c3b6 to 683bca53d4d7 (3 revisions) (flutter/flutter#134778)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 035932d64017 to 3a3a2807c3b6 (5 revisions) (flutter/flutter#134769)
2023-09-14 47866232+chunhtai@users.noreply.github.com Allows page removal that contains Localhistoryentry (flutter/flutter#134757)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from e0b5b6c4eb76 to 035932d64017 (2 revisions) (flutter/flutter#134763)
2023-09-14 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking #3 (flutter/flutter#134576)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2cd34d23c1a2 to e0b5b6c4eb76 (2 revisions) (flutter/flutter#134755)
2023-09-14 15619084+vashworth@users.noreply.github.com Set xcode version to older compatible version for microbenchmarks_ios_xcode_debug test (flutter/flutter#134693)
2023-09-14 82763757+NobodyForNothing@users.noreply.github.com Cover some Services tests with leak tracing (flutter/flutter#134381)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4160ebacdae2 to 2cd34d23c1a2 (18 revisions) (flutter/flutter#134749)
2023-09-14 github@alexv525.com � Setup color tween for `RefreshIndicator` in a better way (flutter/flutter#134492)
2023-09-14 leroux_bruno@yahoo.fr Fix NavigationRail hover misplaced when using large icons (flutter/flutter#134719)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from cd90cc8469fb to 4160ebacdae2 (5 revisions) (flutter/flutter#134695)
2023-09-14 30870216+gaaclarke@users.noreply.github.com Added a devicelab test for vulkan validation layers (flutter/flutter#134685)

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
Please CC camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
flutter/flutter@58ba6c2...72b69f9

2023-09-15 polinach@google.com Date picker dialog state should dispose members. (flutter/flutter#134804)
2023-09-15 engine-flutter-autoroll@skia.org Roll Packages from 275b76c to bc8c2f2 (7 revisions) (flutter/flutter#134823)
2023-09-15 leroux_bruno@yahoo.fr Fix navigation rail hover misplaced when direction is RTL and extended is true (flutter/flutter#134815)
2023-09-15 k_hayashi@yumemi.co.jp Applied the logo to the Discord badge. (flutter/flutter#134339)
2023-09-15 sokolovskyi.konstantin@gmail.com Fix memory leak in ListWheelScrollView (flutter/flutter#134732)
2023-09-15 zanderso@users.noreply.github.com Move two tests on Pixel 7 from staging to prod (flutter/flutter#134784)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 683bca53d4d7 to 45bc4307cda3 (2 revisions) (flutter/flutter#134789)
2023-09-14 pavel.mazhnik@gmail.com [web] provide serviceWorkerVersion to the getNewServiceWorker function (flutter/flutter#131240)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3a3a2807c3b6 to 683bca53d4d7 (3 revisions) (flutter/flutter#134778)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 035932d64017 to 3a3a2807c3b6 (5 revisions) (flutter/flutter#134769)
2023-09-14 47866232+chunhtai@users.noreply.github.com Allows page removal that contains Localhistoryentry (flutter/flutter#134757)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from e0b5b6c4eb76 to 035932d64017 (2 revisions) (flutter/flutter#134763)
2023-09-14 sokolovskyi.konstantin@gmail.com Cover more test/widgets tests with leak tracking flutter#3 (flutter/flutter#134576)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2cd34d23c1a2 to e0b5b6c4eb76 (2 revisions) (flutter/flutter#134755)
2023-09-14 15619084+vashworth@users.noreply.github.com Set xcode version to older compatible version for microbenchmarks_ios_xcode_debug test (flutter/flutter#134693)
2023-09-14 82763757+NobodyForNothing@users.noreply.github.com Cover some Services tests with leak tracing (flutter/flutter#134381)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4160ebacdae2 to 2cd34d23c1a2 (18 revisions) (flutter/flutter#134749)
2023-09-14 github@alexv525.com � Setup color tween for `RefreshIndicator` in a better way (flutter/flutter#134492)
2023-09-14 leroux_bruno@yahoo.fr Fix NavigationRail hover misplaced when using large icons (flutter/flutter#134719)
2023-09-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from cd90cc8469fb to 4160ebacdae2 (5 revisions) (flutter/flutter#134695)
2023-09-14 30870216+gaaclarke@users.noreply.github.com Added a devicelab test for vulkan validation layers (flutter/flutter#134685)

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
Please CC camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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 f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
2 participants