-
Notifications
You must be signed in to change notification settings - Fork 61
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
onChange handler called on Enter and once again after debounceTimeout #64
Comments
+1 |
Makes sense. I would be happy to accept a PR on this |
Let me take a crack at fixing this. @nkbt One thing though, why would you need to handle enter once timeout has passed. Rather it should be the |
Thanks @hozefaj! Timeout should be cancelled on Enter, that feels like the most logical way. |
This is an issue with both notify on enter, and also notify on blur. The problem is this line
|
That is ok, since lodash.debounce has .cancel method available ondebounced functions |
In that case, the problem is
|
I've now fixed this bug, with code submitted as part of this PR |
Should be fixed in |
I'm using something like this:
handleInputChange(e) { this.props.onInputChange(e.target.value); }
and on my render method:
<DebounceInput type='text' onChange={ this.handleInputChange.bind(this) } debounceTimeout={ 1000 } />
I see that
handleInputChange
is also called when I press Enter from the input field (although I could handle that myself in anonSubmit
handler on the form). I assume that's intended, but why then doeshandleInputChange
fires again after the timeout?Scenario:
I see that I can use
forceNotifyByEnter
so it's not called on Enter key press. That solves the problem, but actually it would be nice to have it being called on Enter key press as well, as long as it clears the timeout.The text was updated successfully, but these errors were encountered: