pnetm
pnetm

Reputation: 25

Using a debounced search handler with antd select

I am trying to create a wrapper component around antd's Select, that adds a debounced function to handle search input. I am using lodash's debounce util function.

However I run into a bug where:

I have created a minimal sandbox that replicates this behavior here: https://codesandbox.io/s/vigorous-glade-495f2z?file=/src/Select.jsx.

Upvotes: 1

Views: 481

Answers (1)

Amit
Amit

Reputation: 311

Remove the searchValue props from the Select component.

const propsToSelect = {
    ...props,
    style: { width: "300px" },
    onSearch: searchHandlerWithDebounce,
    filterOption: false,
    options: []
  };

Upvotes: 1

Related Questions