Skip to content

Conversation

@2shrestha22
Copy link
Contributor

@2shrestha22 2shrestha22 commented May 2, 2023

This PR will add ability to debounce Autocomplete widget by only calling options builder when needed. It is useful to limit API requests.

List which issues are fixed by this PR. You must list at least one issue.
#125857

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 2, 2023
@2shrestha22 2shrestha22 marked this pull request as ready for review May 2, 2023 03:43
@HansMuller HansMuller requested a review from justinmc May 4, 2023 16:14
@justinmc
Copy link
Contributor

justinmc commented May 8, 2023

Thanks for opening this issue and PR. I meant to do a better job showing how to do things like debouncing more easily, but I never got around to it.

I went ahead and opened a PR with an example of doing debouncing now, without the change in your PR: #126283.

I think my current opinion is that we shouldn't add a built-in way to do this like you're suggesting, and instead we should just do a better job explaining how to do debouncing etc. on your own. I worry about bloating the number of parameters and making Autocomplete opinionated about how debouncing should work. What do you think after looking at the example in my PR? Does that cover your use case?

@justinmc justinmc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 8, 2023
@2shrestha22
Copy link
Contributor Author

2shrestha22 commented May 9, 2023

Thank you @justinmc for the example. It covers my use case. By providing an example in the documentation, users will not struggle to find a working solution.

@justinmc
Copy link
Contributor

justinmc commented May 9, 2023

Alright sounds good, let's go ahead and close this PR. If more people end up finding your issue and still asking for a built-in debounce, then I'll come back to this PR.

@justincbeck
Copy link

I came across this because I was looking for a way to debounce my requests. The example solution works so I've implemented that. My two cents about it though is that it's a pretty complex solution (I, at least, found it a little difficult to follow) that could be implemented into the AutoComplete class.

Either way, thanks for considering this PR and also thanks for adding the example in the docs. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants