jacobworrel / react-windowed-select

An integration of react-window with react-select to efficiently render large lists.
MIT License
142 stars 38 forks source link

Dynamic heights bugged when searching #51

Closed amy-lei closed 3 years ago

amy-lei commented 3 years ago

The options look great on initial load, but when I start searching, it gets a little weird. The example below is from the codesandbox linked in #31 . bug

On my own branch, I found a workaround by taking setMeasuredHeight out of the if block, but it's at the cost of more rerenders. https://github.com/jacobworrel/react-windowed-select/blob/1f6c52bb3d7e0528af2b53a2eb2e94564ea4585b/src/MenuList.js#L158-L162

jacobworrel commented 3 years ago

@amy-lei Thanks for opening an issue! Would you be interested in submitting a PR - I think your workaround is fine unless there's a noticeable performance lag.

amy-lei commented 3 years ago

@jacobworrel Just submitted! I'm not sure if there's any tests I could've added.

jacobworrel commented 3 years ago

Thanks - will try to get this reviewed and merged as soon as I can.

jacobworrel commented 3 years ago

@amy-lei This is much better, but the option height is still not calculated correctly when searching for an option with a larger height (see attached screenshot). To reproduce, you can search for "Lorem" in the "long label text" story. Would you be interested in taking a look at this?

Screen Shot 2021-02-12 at 2 40 54 PM
amy-lei commented 3 years ago

Hmm I can try to look into this too.

jacobworrel commented 3 years ago

Thanks @amy-lei ! Let me know if you have any questions.