Skip to content

Commit

Permalink
Don't trigger onChange when mounting NumberWidget component
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed Jun 28, 2024
1 parent 40645b3 commit 6989021
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/components/widgets/NumberWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export default class NumberWidget extends React.Component {
this.distance = 0;
this.onMouseDownValue = 0;
this.prevPointer = [0, 0];

this.setValue(this.props.value);
this.onBlur();
}

onMouseMove = (event) => {
Expand Down Expand Up @@ -131,7 +128,6 @@ export default class NumberWidget extends React.Component {

onBlur = () => {
this.setValue(parseFloat(this.input.current.value));
this.setState({ class: '' });
};

onChange = (e) => {
Expand All @@ -143,7 +139,6 @@ export default class NumberWidget extends React.Component {

// enter.
if (event.keyCode === 13) {
this.setValue(parseFloat(this.input.current.value));
this.input.current.blur();
return;
}
Expand Down Expand Up @@ -171,7 +166,6 @@ export default class NumberWidget extends React.Component {
onKeyDown={this.onKeyDown}
onChange={this.onChange}
onMouseDown={this.onMouseDown}
onFocus={this.onFocus}
onBlur={this.onBlur}
/>
);
Expand Down

0 comments on commit 6989021

Please sign in to comment.