Repository navigation
SearchAnchor can show stale results when async suggestions complete out of order #190205
Description
Activity
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage teamframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 30, 2026 @cuishuang Thanks for report the issue. I was able to reproduce this issue locally on Windows using the provided code sample.
When I clicked the search bar and quickly typedafollowed byb, I observed the suggestions changing froma-resulttoab-resultand then back to the stalea-result. Routing to theteam-designfor further investigation.search.mp4
Flutter Doctor Output
[√] Flutter (Channel stable, 3.44.8, on Microsoft Windows [Version 10.0.26200.8875], locale en-IN) [415ms] • Flutter version 3.44.8 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 058e0af2c2 (6 days ago), 2026-07-23 10:56:21 -0700 • Engine revision 0cd610717b • Dart version 3.12.2 • DevTools version 2.57.0 • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration [√] Windows Version (Windows 11 or higher, 25H2, 2009) [1,070ms] [√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [3.1s] • Android SDK at C:\Android\Sdk • Emulator version 36.5.11.0 (build_id 15261927) (CL:N/A) • Platform android-36.1, build-tools 36.1.0 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java This is the JDK bundled with the latest Android Studio installation on this machine. To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`. • Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108) • All Android licenses accepted. [√] Chrome - develop for the web [130ms] • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.6.1) [129ms] • Visual Studio at C:\Program Files\Microsoft Visual Studio\18\Community • Visual Studio Community 2026 version 18.6.11819.183 • Windows 10 SDK version 10.0.26100.0 [√] Connected device (3 available) [336ms] • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.8875] • Chrome (web) • chrome • web-javascript • Google Chrome 150.0.7871.187 • Edge (web) • edge • web-javascript • Microsoft Edge 150.0.4078.83 [√] Network resources [1,151ms] • All expected network resources are available. • No issues found!
Reacted by cui fliter@cuishuang Thanks for report the issue. I was able to reproduce this issue locally on Windows using the provided code sample. When I clicked the search bar and quickly typed
afollowed byb, I observed the suggestions changing froma-resulttoab-resultand then back to the stalea-result. Routing to theteam-designfor further investigation.search.mp4
Flutter Doctor Output[√] Flutter (Channel stable, 3.44.8, on Microsoft Windows [Version 10.0.26200.8875], locale en-IN) [415ms]
• Flutter version 3.44.8 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 058e0af (6 days ago), 2026-07-23 10:56:21 -0700
• Engine revision 0cd6107
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios,
cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging,
enable-uiscene-migration[√] Windows Version (Windows 11 or higher, 25H2, 2009) [1,070ms]
[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [3.1s]
• Android SDK at C:\Android\Sdk
• Emulator version 36.5.11.0 (build_id 15261927) (CL:N/A)
• Platform android-36.1, build-tools 36.1.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use:flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
• All Android licenses accepted.[√] Chrome - develop for the web [130ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe[√] Visual Studio - develop Windows apps (Visual Studio Community 2026 18.6.1) [129ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\18\Community
• Visual Studio Community 2026 version 18.6.11819.183
• Windows 10 SDK version 10.0.26100.0[√] Connected device (3 available) [336ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.8875]
• Chrome (web) • chrome • web-javascript • Google Chrome 150.0.7871.187
• Edge (web) • edge • web-javascript • Microsoft Edge 150.0.4078.83[√] Network resources [1,151ms]
• All expected network resources are available.• No issues found!
Thank you for reproducing this. I've submitted a pull request to try and fix it; please refer to it. #190206
- addedP2Important issues not at the top of the work listImportant issues not at the top of the work listtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
on Aug 5, 2026 - addedpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.and removedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Aug 17, 2026 - added a commit that references this issue
on Aug 27, 2026 - added 2 commits that reference this issue
on Sep 9, 2026 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 10, 2026
Steps to reproduce
a, then immediately typeb, so that the current query becomesab.The request for
aintentionally takes 500 ms, while the request forabtakes only 50 ms.Expected results
Only the suggestions for the latest query,
ab, should be displayed.Actual results
The
ab-resultsuggestion is displayed first, but is later replaced by the stalea-resultwhen the older request completes.SearchAnchor.suggestionsBuilderacceptsFutureOr<Iterable<Widget>>, but_ViewContentStatecurrently applies every completed result as long as the widget is mounted. It does not verify that the completed request is still the most recent request.This can also occur between the initial suggestions request started from
didChangeDependenciesand later requests triggered by controller changes.RawAutocompletealready avoids the same class of race by assigning a call ID to each asynchronous options request.Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output