Browse Source

Don't submit edit request if the value didn't change

Fela Maslen 7 năm trước cách đây
mục cha
commit
082f27b849
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      src/components/CrudField/index.js

+ 3 - 1
src/components/CrudField/index.js

@@ -39,7 +39,9 @@ export default class CrudField extends Component {
     };
 
     onEditEnd = () => {
-        this.props.onEditEnd(this.props.field, this.state.editValue);
+        if (this.state.editValue !== this.props.value) {
+            this.props.onEditEnd(this.props.field, this.state.editValue);
+        }
 
         this.setState({
             editing: false