-
-
Notifications
You must be signed in to change notification settings - Fork 276
[combobox][autocomplete] Add filteredItems prop to improve virtualized demos with object items
#3068
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
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
1816b95 to
98a0757
Compare
98a0757 to
a10dae0
Compare
mnajdova
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better 👌
| // Floating UI tests don't require `role="row"` wrappers, so retains the number API. | ||
| cols: grid ? 2 : 1, | ||
| orientation: grid ? 'horizontal' : undefined, | ||
| disabledIndices: virtualized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this logic changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not actually necessary, but I was debugging an issue with the virtualized demos which I PR'd here: #3066
This improves the
virtualizeddemos when the item values are objects. Three issues were occurring before:filteredItemsprop to the root components, which overrides the internal filtering. Two passes of filtering was occurring (external + internal) and you needed to passfilter={contains}to sync the internal and external filtering together. This reduces it to one pass and removes this need to sync the filtering.JSON.stringify()serialization was being performed on every single item, which made filtering slow. Now theuseFilterhook has the third optional paramitemToStringin its types (previously it only existed at runtime), which should be passed when externally filtering object items.React.useDeferredValue()can be used to improve typing performance while filtering work is ongoingNow with 10,000 object items, even with 20x slowdown (M4 Pro), it's speedy:
Screen.Recording.2025-10-27.at.8.26.35.am.mov