Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Dec 20, 2024

Description

This PR reverts DropdownMenu changes from #155757.
Automatically rematching the initialSelection breaks some use cases.
It is more flexible to let users manipulate the text field content using the TextEditingController.

Related Issue

Fixes Dropdown Menu Creates Infinite Build Loop
Fixes Can no longer initialize non selectable value in DropdownMenu as of flutter version 3.27.1

Tests

Removes 2 regression tests from #155757.
Keeps 2 tests from the original PR (missing test for the initialSelection behavior).
Adds 1 tests to avoid regressing this revert.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Dec 20, 2024
@bleroux bleroux marked this pull request as ready for review December 20, 2024 06:27
Copy link
Contributor

@nate-thegrate nate-thegrate left a comment

Choose a reason for hiding this comment

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

Who would have thought that the single request from #155660 would result in 3 PRs in total?

Thanks for all the work you've put into this!

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 20, 2024
@auto-submit auto-submit bot added this pull request to the merge queue Dec 21, 2024
Merged via the queue into flutter:master with commit 2a3a19c Dec 21, 2024
100 of 101 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 21, 2024
@andreasmpet
Copy link

andreasmpet commented Jan 2, 2025

When will this change be live you think?
The related change that is being reverted caused a huge regression for my app, and it's only by pure luck (and holidays) that I didn't release a new production version with this error present. I usually see it as a risk free thing to upgrade flutter-versions, so I don't usually don't do full regression tests when updating.

My usecase is indeed as others have mentioned an address search, where alternatives are updated as the user types into the search field.

@nate-thegrate
Copy link
Contributor

nate-thegrate commented Jan 5, 2025

@andreasmpet thanks for sharing your experience. We might be able to get this cherry-picked into 3.27.2 within the next few weeks.


Edit: cherry-pick pull request was merged! This fix should indeed show up in 3.27.2.

@nate-thegrate nate-thegrate added the cp: stable cherry pick this pull request to stable release candidate branch label Jan 6, 2025
@flutteractionsbot

This comment was marked as resolved.

@bleroux bleroux deleted the revert_rematching_DropdownMenu_initialSelection branch January 6, 2025 15:23
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 8, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 8, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 8, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 8, 2025
auto-submit bot pushed a commit that referenced this pull request Jan 9, 2025
…n when entries have changed" (#161177)

This pull request reverts the changes in #155757.

The auto-formatter created conflicts in the master branch, so the revert was performed manually in #160643.
For this cherry-pick PR, I was able to run `git revert 21381d8` without any problems.

<br>

### Issue Links

bug reports: #160196, #160555
cherry-pick request: #161176

### Target

stable

### Changelog Description

Passing a list literal to a `DropdownMenu` causes the widget to reset to the `initialSelection` after each build.

### Impacted Users

This affects anyone using the [DropdownMenu](https://api.flutter.dev/flutter/material/DropdownMenu-class.html) widget.

### Impact Description

The impact usually consists of the text value being inconveniently reset each time the widget is rebuilt. (In some cases it can be a fatal crash: the code sample from #160196 shows how this change can lead to an infinite build loop.)

### Workaround

This regression can be mitigated by caching & modifying a single list instance, rather than using a list literal for the `DropdownMenu` constructor.

### Risk

low

### Test Coverage

yes

### Validation Steps

#160643 added a regression test for this revert.

The fix can also be verified by running the code sample from #160196 and verifying that there is no infinite build loop.
@andreasmpet
Copy link

Superb that this fix is fast-tracked. When is the estimated release for 3.27.2?
Are we talking days, weeks or months?

Thanks!

@nate-thegrate
Copy link
Contributor

nate-thegrate commented Jan 9, 2025

@andreasmpet I unfortunately don't know the answer, since it is up to the release team and is not public information. My best guess would be that it's on the scale of "weeks" edit: released on January 13!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp: stable cherry pick this pull request to stable release candidate branch f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can no longer initialize non selectable value in DropdownMenu as of flutter version 3.27.1 Dropdown Menu Creates Infinite Build Loop

4 participants