Skip to content

feat: Add excludedItems parameter to autocomplete function with dynamic size adjustment #1027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AffanShaikhsurab
Copy link
Contributor

What

  • Added excludedItems parameter to filter out unwanted items from auto-suggestions.
  • Dynamically adjusted the size parameter to request additional items based on the length of the exclusion list.
  • Ensured safety by handling potential null values in excludedItems.
  • Improved overall flexibility of the autocomplete functionality.

Fixes bug(s)

#889

Part of

…ic size adjustment


**Description (optional):**  
- Added `excludedItems` parameter to filter out unwanted items from auto-suggestions.  
- Dynamically adjusted the `size` parameter to request additional items based on the length of the exclusion list.  
- Ensured safety by handling potential null values in `excludedItems`.  
- Improved overall flexibility of the autocomplete functionality.
Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Hi @AffanShaikhsurab!
Please have a look at my comments about minor issues.
But other related parts of the code needs to be impacted too:

  • OpenFoodAPIClient.getSuggestions
  • Autocompleter
  • AutocompleteManager
  • TagTypeAutocompleter
  • TaxonomyNameAutocompleter

In addition to that, the code must be tested, in api_suggestion_manager_test.dart and api_search_test.dart.

- Updated impacted components:
  - `OpenFoodAPIClient.getSuggestions`
  - `Autocompleter`
  - `AutocompleteManager`
  - `TagTypeAutocompleter`
  - `TaxonomyNameAutocompleter`
- Added/updated tests in `api_suggestion_manager_test.dart` and `api_search_test.dart`.
- Addressed minor review comments.
@AffanShaikhsurab
Copy link
Contributor Author

I have made the changes. Could you please check if they are valid? Also, what should we pass as excludedList in the api_suggestion_manager_test?

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

Successfully merging this pull request may close these issues.

2 participants