Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented May 8, 2020

… matching route

Description

The navigator refactor accidentally change the behavior of pushAndRemoveUntil method. Instead of stopping at the first route that match the predicate, it continue scanning through the entire route history and removing all the routes that does not match the predicate.

This pr fixes it.

Related Issues

Fixes #56688

Tests

I added the following tests:

See files

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label May 8, 2020
@Piinks Piinks added the f: routes Navigator, Router, and related APIs. label May 11, 2020
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

// Regression https://github.com/flutter/flutter/issues/56688
final GlobalKey<NavigatorState> navigator = GlobalKey<NavigatorState>();
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/' : (BuildContext context) => const Text('home'),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'/' : (BuildContext context) => const Text('home'),
'/': (BuildContext context) => const Text('home'),

@goderbauer
Copy link
Member

Did this bug make it into the latest stable? We should consider a cherry-pick if it did since this could potentially break apps pretty badly...

@chunhtai
Copy link
Contributor Author

Did this bug make it into the latest stable? We should consider a cherry-pick if it did since this could potentially break apps pretty badly...

unfortunately yes... cc @tvolkert Is there a process to evaluate whether we should push a hot fix for this bug?

@tvolkert
Copy link
Contributor

@chunhtai the process is to apply the cherry-pick request label to the issue. I just labeled #56688 accordingly. @pcsosinski FYI

@fluttergithubbot fluttergithubbot merged commit 1bb9f3f into flutter:master May 12, 2020
pcsosinski pushed a commit to pcsosinski/flutter that referenced this pull request May 12, 2020
pcsosinski pushed a commit to pcsosinski/flutter that referenced this pull request May 12, 2020
pcsosinski pushed a commit that referenced this pull request May 13, 2020
* Always remove the workspace settings (#56703)

* [flutter_tools] hide tree-shake-icons (#56924)

* fix pushAndRemoveUntil incorrectly removes the routes below the first… (#56732)

* Update engine hash for 1.17.1

* fix customer_testing-windows

Co-authored-by: Jenn Magder <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: chunhtai <[email protected]>
pcsosinski pushed a commit that referenced this pull request May 13, 2020
* Always remove the workspace settings (#56703)

* [flutter_tools] hide tree-shake-icons (#56924)

* fix pushAndRemoveUntil incorrectly removes the routes below the first… (#56732)

* let the embedding maven engine dependency reference the storage proxy (#56164)

* typo fix on the FLUTTER_STORAGE_BASE_URL usage (#56685)

* Update engine hash for 1.18.0-11.1.pre

Co-authored-by: Jenn Magder <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: xster <[email protected]>
Co-authored-by: Luke Cheng <[email protected]>
@mxa0079
Copy link

mxa0079 commented Jun 16, 2020

When can we expect this to fix to make it to the stable channel? We are considering rolling back to 1.12 due to this breaking change.

@pcsosinski
Copy link

pcsosinski commented Jun 16, 2020

@mxa0079 this fix is in 1.17.1+

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pushAndRemoveUntil removing initialRoute in navigation stack after upgrading to v1.17

8 participants