Skip to content
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

feat: virtualize search over all filters list (#298) #326

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

hunterckx
Copy link
Collaborator

Notes:

  • I've made it so the Autocomplete doesn't handle the list items, and instead has its ListboxComponent parameter set to a component that renders the list without using the children passed to it by the Autocomplete. My reasoning is that we aren't using the Autocomplete as an actual autocomplete anyway, and it's more straightforward to give the virtualized list full control over the items.
  • I created a copy of the existing VariableSizeList component (putting it under SearchAllFilters/components without any name changes), and used that for the virtualized list, which means I ended up deleting the AutocompleteListbox component (after moving its sizing function into VariableSizeList).
  • I've kept just the single map for storing element heights, so I have it give each option a unique key constructed from the category key and value key; see applyMenuFilter in the new VariableSizeList.tsx (particularly line 211). Hopefully this is a reasonably simple strategy -- I feel that it might be simpler than other solutions such as using a separate map for each category.
  • Referencing MUI's virtualization example, I've used contexts to provide information to components that are passed to the Autocomplete and the virtual list (specifically for the ListboxComponent and the OuterElementType respectively)

Copy link
Collaborator

@frano-m frano-m left a comment

Choose a reason for hiding this comment

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

Absolutely 💯, ⭐ , 🚀 , 🎸 and 🏆 . Thank you @hunterckx

@hunterckx hunterckx merged commit 707c90f into main Aug 10, 2023
1 check passed
@hunterckx hunterckx deleted the hunter/298-virtualize-search-all-filters branch August 10, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants