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

Virtualize select options #763

Open
fredmaggiowski opened this issue Dec 13, 2024 · 0 comments
Open

Virtualize select options #763

fredmaggiowski opened this issue Dec 13, 2024 · 0 comments
Labels
enhancement New feature or request Select component Select component and hooks related activities

Comments

@fredmaggiowski
Copy link
Member

The feature or bug you are proposing

I need to display thousands menu items in the select, each menu item needs to dynamically load a different icon. The current Select component does not let me implement this in a way that is productive without freezing the browser as soon as you click the select.

A snippet of code for replicating the issue or showing the proposal usage if applicable

Attempting to see how the select behaves when using antd optionRender, I've prepared a story as such:

export const LotsOfOptions: Story = {
  args: {
    options: new Array(2000).fill('option')
      .map((val, i) => ({ label: `${val} ${i}`, value: i })),
    optionRender: (option) => {
      console.log('render', option)
      return <strong>{option.label}</strong>
    },
  },
}

however as soon as I open the select

immagine

The expected result for your bug

virtualization to happen and the render function to be invoked at need

@fredmaggiowski fredmaggiowski added enhancement New feature or request Select component Select component and hooks related activities labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Select component Select component and hooks related activities
Projects
None yet
Development

No branches or pull requests

1 participant