-
Notifications
You must be signed in to change notification settings - Fork 934
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
Impossible to override input received on onInputValueChange
after item selection
#759
Comments
It may be strange, but apparently it's the result of #217 you can check there and see why they did it at that time. However what is important is what actually you try to achieve. If this blocks a scenario then we can discuss on that and come up with a solution. Using stateReducer and on{prop}Changed at the same time for the same state prop is probably a sign that you are doing something wrong. :D |
Thank you for your quick reply @silviuavram ! :D I will explain what I am trying to achieve (a bit simplified): I have I have created in CodeSandbox one example reproducing the problem, with the 5 variations I can think of to address the issue:
In the end I tracked down that issue to what I pointed on my first message. |
I've been caught up with the work for |
I am having a similar issue today. I want to restore a blank input value on blur (for example, when changes.inputvalue length is 0 in the state reducer) to the previous input value (which I store in state outside of Downshift). I can't make that happen. Any progress on a solution for this from anyone? |
I was able to make this work. The reason why I couldn't get the stateReducer to listen to a blur was because I was managing the event outside of Downshift. Once I realized this, I was able to trigger a "closeMenu" on blur, and then listen for the blurEvent. But this would be solved with the ability to force a state update through the stateReducer for custom state changes. Is there a way to do that? |
downshift
version: 3.2.10node
version: 10.15.3yarn
version: 1.17.3Relevant code or config
What you did:
I tried to override via
stateRducer
theinputValue
after some item is selected.What happened:
The internal state gets updated, but then I receive from
onInputValueChange
the selected item string, instead of theinputValue
in state.Reproduction repository:
It is the basic autocomplete with minimum modifications and some explanations:
Codesandbox
Problem description:
I can't get the
inputValue
that I have overridden viastateReducer
fromonInputValueChange
after an item is selected. I always get the selected item string instead. This behaviour seems to be unexpected.Suggested solution:
I have no suggestion yet! Can you confirm this is an unexpected behaviour?
The text was updated successfully, but these errors were encountered: