Sfoglia il codice sorgente

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

Fela Maslen 7 anni fa
parent
commit
082f27b849
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  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