Sitelet https://github.com/flutter/packages/pull/12478
Skip to content

[material_ui] Prevent stale async suggestions in SearchAnchor - #12478

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
cuishuang:port-190206-search-anchor
Aug 27, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
cuishuang:port-190206-search-anchor

Conversation

@cuishuang

@cuishuang cuishuang commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Ports flutter/flutter#190206 to material_ui following flutter/flutter#188444.

Fixes flutter/flutter#190205.

This change prevents an older asynchronous SearchAnchor.suggestionsBuilder request from replacing the results of a newer request.

It assigns an incrementing ID to each suggestions request and only applies the result when it still represents the latest request.

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui labels Aug 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates SearchAnchor to prevent stale asynchronous suggestions from overwriting newer results. It introduces an internal counter, _suggestionsCallId, to track suggestion requests and discard results from outdated calls. A new test case has been added to verify that out-of-order asynchronous suggestions are ignored. No review comments were provided, and there is no feedback to provide.

@cuishuang
cuishuang force-pushed the port-190206-search-anchor branch from ae1683b to e6b6758 Compare August 16, 2026 01:09
@Piinks Piinks added triage-design Should be looked at in design triage and removed triage-framework Should be looked at in framework triage labels Aug 17, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Aug 19, 2026

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM since this PR is ported over from flutter/flutter:) Could you also make sure all items in "Pre-Review Checklist" are checked?

@QuncCccccc QuncCccccc added CICD Run CI/CD and removed CICD Run CI/CD labels Aug 19, 2026
@dkwingsmt dkwingsmt changed the title [material_ui] Port flutter/flutter #190206 "Prevent stale async suggestions in SearchAnchor" [material_ui] Prevent stale async suggestions in SearchAnchor Aug 19, 2026
@cuishuang

Copy link
Copy Markdown
Contributor Author

LGTM since this PR is ported over from flutter/flutter:) Could you also make sure all items in "Pre-Review Checklist" are checked?

Thanks! I've checked the applicable checklist items.

The Linux_web web_dart_unit_test_wasm_shard_1 master presubmit timed out. Could you please rerun the failed job?

image

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 26, 2026
@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Aug 26, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@auto-submit

auto-submit Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12478, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@auto-submit

auto-submit Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12478, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@QuncCccccc
QuncCccccc force-pushed the port-190206-search-anchor branch from 22a0c34 to 98e16d4 Compare August 26, 2026 23:09
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 26, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Aug 26, 2026
@auto-submit
auto-submit Bot merged commit ccd22e1 into flutter:main Aug 27, 2026
13 checks passed
pull Bot pushed a commit to Mu-L/flutter that referenced this pull request Aug 28, 2026
…er#191965)

flutter/packages@bd3cbc1...cd4cdd0

2026-08-28 21270878+elliette@users.noreply.github.com [material_ui] Add
all M3 templates and generated code to `temporarily_excluded/` before
migration (flutter/packages#12661)
2026-08-28 engine-flutter-autoroll@skia.org Roll Flutter from
15d8908 to e8dca90 (58 revisions) (flutter/packages#12660)
2026-08-28 bkonyi@google.com [various] Update pigeon dev_dependency to
^27.3.2 (flutter/packages#12615)
2026-08-27 269567208+reidbaker-agent@users.noreply.github.com
[camera_android_camerax] Enforce CHANGELOG backticks and add eval commit
author check to pre-push-skill (flutter/packages#12624)
2026-08-27 imcusg@gmail.com [material_ui] Prevent stale async
suggestions in SearchAnchor (flutter/packages#12478)
2026-08-27 bkonyi@google.com [go_router_builder] Support analyzer 14
(flutter/packages#12614)
2026-08-27 srawlins@google.com [cupertino_ui] Use super parameters in
more places (flutter/packages#12459)
2026-08-27 32538273+ValentinVignal@users.noreply.github.com
[material_ui] Remove no-shuffle from progress indicator test
(flutter/packages#12505)
2026-08-27 32538273+ValentinVignal@users.noreply.github.com
[two_dimensional_scrollables] Activate leak testing and fix memory leaks
(flutter/packages#11653)
2026-08-27 21270878+elliette@users.noreply.github.com [material_ui] Add
helper methods in gen_defaults template (flutter/packages#12637)
2026-08-27 brackenavaron@gmail.com [cupertino_ui] fix CupertinoIcons
font not being included in examples and fix TextEditingController leaks
(flutter/packages#12228)
2026-08-27 269567208+reidbaker-agent@users.noreply.github.com
[camera_android_camerax] Check Git hooks configuration in
check-readiness skill (flutter/packages#12628)
2026-08-27 47866232+chunhtai@users.noreply.github.com [ci] sync back pr
for branch release only run when release succeeds
(flutter/packages#12581)
2026-08-27 stuartmorgan@google.com [google_maps_flutter] Convert overlay
controllers to Swift (flutter/packages#12638)
2026-08-27 47866232+chunhtai@users.noreply.github.com
[go_router_builder] Fixes text golden test to ignore platform specific
newline (flutter/packages#12652)

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-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12478)

Ports flutter/flutter#190206 to `material_ui` following flutter/flutter#188444.

Fixes flutter/flutter#190205.

This change prevents an older asynchronous `SearchAnchor.suggestionsBuilder` request from replacing the results of a newer request.

It assigns an incrementing ID to each suggestions request and only applies the result when it still represents the latest request.

## Pre-Review Checklist

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12478)

Ports flutter/flutter#190206 to `material_ui` following flutter/flutter#188444.

Fixes flutter/flutter#190205.

This change prevents an older asynchronous `SearchAnchor.suggestionsBuilder` request from replacing the results of a newer request.

It assigns an incrementing ID to each suggestions request and only applies the result when it still represents the latest request.

## Pre-Review Checklist

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
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 CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SearchAnchor can show stale results when async suggestions complete out of order

4 participants