Closed justinsmid closed 2 years ago
Thanks for reporting, I'll try to add memoization to transfer list item props and see if it resolves the issue. Actually, I think we also have the same performance in Select and MultiSelect components, so maybe memoization will also do the trick there.
I've added memoization like so – https://codesandbox.io/s/mantine-transferlist-performance-forked-mf78u?file=/src/App.js It seems to be a little better, not perfect. Is performance in my sandbox as bad as in yours?
It's noticeably better than before in your sandbox, but like you said, not perfect.
Have you considered using a virtual list for rendering the items? I haven't tried it, but I would assume that would solve the issue entirely.
I'm not sure how you would want to go about implementing it, but a library like react-virtualized (or the more light-weight variant react-window) seem quite applicable. There's even react-virtualized-select for select components that you might be able to use for the Select components like you mentioned.
in their demo, i have no performance issues when rendering a list, regardless of the amount of elements.
My concern with virtualized libraries is that almost all of them will take ~30% of @mantine/core bundle, so I'd rather implement limit
prop like in Select.
In 3.6.0 transfer list now comes with limit
prop, it can be used to fix performance issues
I have noticed scrolling and interacting with the TransferList gets very slow and sluggish when using a large number of items (starts around 300 items for me).