Replies: 1 comment 1 reply
-
|
Looked into this and it seems related to the If you switch the import { Key } from '@solid-primitives/keyed'and switch the rendering to <Key each={collection().items} by={(item) => item}>
{(item) => (
<Combobox.Item item={item()}>
<Combobox.ItemText>{item()}</Combobox.ItemText>
<Combobox.ItemIndicator>✓</Combobox.ItemIndicator>
</Combobox.Item>
)}
</Key> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This problem might have more to do with Zag.js than Ark UI, but since I don't have Zag.js-specific examples, and since the core team members are the same between projects, posting it here.
I've been working on a custom Combobox implementation in Solid, and with large enough items in the ComboboxContent children, I'm observing significant performance penalty in Solid implementation for it - and we are not talking about lots of items, I only have like 200+ items for a country selector, and I'm already observing a penalty, with Ark seemingly recalculating all of the children every time I hover on content items, all the time.
That problem, however, is much less pronounced in React version of the same component - React is just several times faster in recalculating its content items.
To visualize the problem, I've prepared two examples:
Solid example: https://stackblitz.com/edit/5pea4dyk?file=src%2FApp.tsx
This is the standard example from Ark UI docs, with modified initialItems set to 3000 items (if your computer is fast, you might need to do more to better visualize the problem).
React example: https://stackblitz.com/edit/864g847c?file=src%2FApp.tsx
This is also. the standard example from Ark UI docs, with modified items collection set to 3000 items.
If you open dropdowns in both controls and just hover around, you'll notice that React combobox is much snappier in general, while Solid's is sluggish (increase the number of items in collections if you don't feel the difference).
While this problem can be mitigated with virtualization, I'm generally perplexed why would the performance difference be so vast, and with React clearly doing better than Solid.
The problem also can be especially visible if you use a form library, like Tanstack form, where every keypress in unrelated form input forces it to recalculate quickly all controls - if I have my country selector control in the form, it will be recalculated with a very poor performance in every keystroke, resulting in a singificantly worse UX.
Is this something that can be addressed, or is it an inherit limitation of Solid implementation?
Beta Was this translation helpful? Give feedback.
All reactions