-
Notifications
You must be signed in to change notification settings - Fork 104
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
fix(ComboBox): moving filtered options out of state #163
Conversation
👍 This fix seems to work for me. Thank you. |
😄 great |
Hey @nikgraf , That should not happen, coz filteredOptions are derived from other parameters in state and props. Check my comments here #162 . @bvleur was facing this issue: "If you arrive at a input value matching an option by pressing backspace, the isMatchingOption won't be set to true." The reason for the issue was that I was updating filteredOptions in state using |
We could even make that explicit in the code by moving from a If the statement above is correct then any change to the input of that function might cause |
We already know specific places where filteredOptions can change, so I think calling function at just those places might be more performant than memoize and calling at each render. Mostly its called only when inputValue changes and in that case re-filtering is actually needed. |
The reason I mentio the The alternative will probably only be slower if the "is it cached"-check is particulary heavy (which I don't think it is) but there is not real need to actually go that route, given that the current implementation (with this fix) works fine. |
Sorry for the late reply! I see what you mean. Good work! |
fix(ComboBox): moving filtered options out of state
Fix for #162