File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/js/components/DataTypes Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,12 @@ class rjvObject extends React.Component {
3131
3232 constructor ( props ) {
3333 super ( props ) ;
34- this . init ( props ) ;
34+ this . state = this . initializeState ( props ) ;
3535 }
3636
3737 state = { }
3838
39- init = ( props ) => {
39+ initializeState = ( props ) => {
4040 const expanded = (
4141 props . collapsed === false
4242 || ( props . collapsed !== true
@@ -58,12 +58,11 @@ class rjvObject extends React.Component {
5858 display_name : ( props . name ? props . name : '' )
5959 }
6060
61- this . state = { ...this . state , ...state } ;
61+ return { ...this . state , ...state } ;
6262 }
6363
6464 componentWillReceiveProps ( nextProps ) {
65- this . init ( nextProps ) ;
66- this . setState ( this . state ) ;
65+ this . setState ( this . initializeState ( nextProps ) ) ;
6766 }
6867
6968 toggleCollapsed = ( ) => {
You can’t perform that action at this time.
0 commit comments