Skip to content

Conversation

@nate-thegrate
Copy link
Contributor

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 21381d843f3feb32640ae385aedd8e5c4003696b without any problems.


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 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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jan 6, 2025
@nate-thegrate nate-thegrate requested a review from bleroux January 6, 2025 19:10
Copy link
Contributor

@bleroux bleroux left a comment

Choose a reason for hiding this comment

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

LGTM!

@Piinks Piinks added the cp: review Cherry-picks in the review queue label Jan 8, 2025
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

LGTM

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 9, 2025
@auto-submit auto-submit bot merged commit d9d3889 into flutter:flutter-3.27-candidate.0 Jan 9, 2025
121 checks passed
@nate-thegrate nate-thegrate deleted the dropdown-cherry-pick branch January 9, 2025 00:12
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 15, 2025
@pamtbaau
Copy link

@bleroux , FYI, this revert does not cause me any issues since my project turned on hold soon after creating issue #155660 and before adapting it to the initial PR.

NB, the initial issue is still locked although re-opened.

@bleroux
Copy link
Contributor

bleroux commented Jan 17, 2025

@pamtbaau Oh good catch for noticing the issue is locked 🙏 . Let me unlock it.

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 cp: review Cherry-picks in the review queue d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos 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.

5 participants