State and Props Lost
Due to wrapping Component, the state and props are not being passed down when used on an Element that's not a simple Input.
Example https://gist.github.com/gpltaylor/57756c5f0fdc5ee1fa4e7157c74275b2
The mouse event is called, Debounce only files are the right time, but the State is not updated as Debounce holds it's own state. However, the problem still happens when converting to props. The Elements XPos and YP{os are not updated and React Chrome debugging shows that the values are not passed into the Component Debounce. This library works for simple click events... it is designed for this type of wrapping?
similar problem. state is not reaching the input that is wrapped by the debounce component. how can i make state update?
Looking at the code, it does not appear to pass props down into the children. this would require a patch to fix this.
Hey guys! Thanks for raising this issue. My apologies for the delay in replying. Could either of you post a use-case which fails, and I'll get started on a fix?
Thanks! :)
great! my use case:
<Debounce time='1500' handler='onKeyUp'>
<input className='text' autoComplete='off' type='text'
disabled={this.state.showLoading}
onKeyUp={(event) => this.handleInputChange(event)} />
</Debounce>
When I log this.state.showLoading just outside the debounce it's definetly coming through so ya debounce is not handing the state through. Thx for having a look!
my Gist shows this in full. When moving the mouse over, the debounce works (thanx for that :)) however the state is not updated (passed down)
https://gist.github.com/gpltaylor/57756c5f0fdc5ee1fa4e7157c74275b2
If you're pressed for time I might be able to look into this over the weekend.
Is this still being worked on? I've encountered the exact same bug with my use-case.
I am still working on this. I haven't had much time lately, but it will be fixed!
Well, your code is cloning the React element, but it does so only once. Also it filters the props, leaving only the handlers. I could fix this by adding a call to componentWillReceiveProps and by using _.assing to compose the object props with the handlers. This is my fork. I will try to merge this now. All test are still passing, but I might be good to add a few more for this feature (I may try when have some time).