Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In reference to issue #130
It was the check we discussed, but not for the reason I thought.
Since migrating from
componentWillReceiveProps
tocomponentDidUpdate
the initial state update on the first keypress is being processed before theisDebouncing
flag is set.Previously, the debouncing flag was getting set before the render occurred, but now it is happening earlier, so I expect you were experiencing difficulty and stuttered renders.
In order to combat hitting a check that the
isDebouncing
flag was intended to avoid, an additional check was added that causes the undesirable rendering behavior.To mitigate, I set it up to conditionally set the
isDebouncing
flag (if denouncing is necessary when callingthis.notify
) before we set the initial state.As far as I can tell, all of the current examples appear to work perfectly and skipping that extra render appears to slightly improve performance as well. (Though I'm no expert in profiling react apps 😀). I also added another example to demonstrate using the input in the context of external validation that can correct the value.