Skip to content

Commit ebdc73e

Browse files
committed
fix: debounce prop value update
1 parent 4def6af commit ebdc73e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/InputSpinner.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class InputSpinner extends Component {
5353
this._setStateMin.bind(this),
5454
this.props.typingTime,
5555
);
56+
this._updateValue = debounce((value) => {
57+
this.setState({value: value});
58+
}, 250);
5659

5760
this.state = {
5861
min: min,
@@ -74,7 +77,7 @@ class InputSpinner extends Component {
7477
if (this.props.value !== prevProps.value) {
7578
let newValue = this.parseNum(this.props.value);
7679
newValue = this.withinRange(newValue);
77-
this.setState({value: newValue});
80+
this._updateValue(newValue);
7881
}
7982
// Parse Min
8083
if (this.props.min !== prevProps.min) {

0 commit comments

Comments
 (0)