File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,17 @@ export default class EdiText extends Component {
19
19
}
20
20
21
21
componentWillReceiveProps ( nextProps ) {
22
- if ( nextProps . value ) {
23
- this . setState ( {
24
- value : nextProps . value
25
- } )
22
+ const nextState = { }
23
+ if ( nextProps . value !== undefined && nextProps . value !== this . state . value ) {
24
+ nextState . value = nextProps . value ;
26
25
}
27
26
28
- if ( nextProps . editing !== undefined ) {
29
- this . setState ( {
30
- editing : nextProps . editing
31
- } )
27
+ if ( nextProps . editing !== undefined && nextProps . editing !== this . state . editing ) {
28
+ nextState . editing = nextProps . editing ;
29
+ }
30
+
31
+ if ( Object . keys ( nextState ) . length > 0 ) {
32
+ this . setState ( nextState ) ;
32
33
}
33
34
}
34
35
@@ -237,7 +238,7 @@ EdiText.defaultProps = {
237
238
type : 'text' ,
238
239
validationMessage : 'Invalid Value' ,
239
240
validation : value => true ,
240
- onCancel : ( ) => { } ,
241
+ onCancel : ( ) => { } ,
241
242
cancelButtonContent : '' ,
242
243
saveButtonContent : '' ,
243
244
editButtonContent : '' ,
You can’t perform that action at this time.
0 commit comments