Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to ignore out-of-order asynchronous suggestions in SearchAnchor by tracking a call ID (_suggestionsCallId) and refactoring suggestion retrieval into a helper method _buildSuggestions(). A test is also added to verify this behavior. The feedback suggests checking if the widget is still mounted before invoking suggestionsBuilder to prevent using BuildContext across asynchronous gaps.
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM! Thanks a lot for your contribution!
|
@QuncCccccc Thank you for your approval. |
|
Thanks for your contribution! This PR has reached completion, however we're not able to merge this PR for the moment due to the Material/Cupertino code freeze (#184093). As soon as the decoupling is complete, we will post a way to port this PR to the new packages to land. In the meantime, I'll convert this PR to a draft and apply a label so that we can quickly find it when the freeze is lifted. |
Thank you for your update and review! I noticed that #184093 is closed, and material_ui/cupertino_ui 1.0.0 is now open for contributions. For porting instructions, please see #188444. Since this PR only affects the Material code and has been approved, do I now need to port it to the flutter/packages(material_ui) directory according to these instructions? |
|
Yes, please! Thank you! |
|
Ported to flutter/packages#12478 Closing this PR per #188444. Thanks @QuncCccccc @dkwingsmt |
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.
…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.
…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.
Fixes #190205
This change prevents an older asynchronous
SearchAnchor.suggestionsBuildercall from replacing the results of a newer call.It assigns a monotonically increasing call ID to suggestions requests and only applies a completed result when its ID still matches the latest request. The same protection is shared by the initial suggestions-loading path and updates triggered by changes to the
SearchController.The existing suggestions builder invocation behavior is preserved.
A regression test starts requests for
aandab, completes theabrequest first, and verifies that completing the olderarequest does not replace the displayedabsuggestions.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot 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.