Explorar o código

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

Fela Maslen %!s(int64=7) %!d(string=hai) anos
pai
achega
082f27b849
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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