File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,8 @@ function Canvas() {
9696 return ;
9797 }
9898
99- const addingComponent = state . components . find ( elem => elem . id === item . instanceTypeId ) ;
100-
101- if ( checkChildren ( [ addingComponent ] , currentComponent ) ) {
102- triedToNestIncorrectly ( ) ;
103- } else {
104- // if item dropped is going to be a new instance (i.e. it came from the left panel), then create a new child component
99+ const runReducers = ( ) => {
105100 if ( item . newInstance ) {
106- console . log ( "still added" ) ;
107101 dispatch ( {
108102 type : 'ADD CHILD' ,
109103 payload : {
@@ -124,6 +118,20 @@ function Canvas() {
124118 } ) ;
125119 }
126120 }
121+
122+ const addingComponent = state . components . find ( elem => elem . id === item . instanceTypeId ) ;
123+
124+ if ( item . instanceType === "HTML Element" ) {
125+ return runReducers ( ) ;
126+ } else if ( item . instanceType === 'Route Link' ) {
127+ return runReducers ( ) ;
128+ } else if ( checkChildren ( [ addingComponent ] , currentComponent ) ) {
129+ triedToNestIncorrectly ( ) ;
130+ return ;
131+ } else {
132+ // if item dropped is going to be a new instance (i.e. it came from the left panel), then create a new child component
133+ return runReducers ( ) ;
134+ }
127135 } ,
128136 collect : monitor => ( {
129137 isOver : ! ! monitor . isOver ( )
Original file line number Diff line number Diff line change @@ -605,14 +605,11 @@ const reducer = (state: State, action: Action) => {
605605 state . HTMLTypes
606606 ) ;
607607 } )
608- let childId : null | number = ( ( state . canvasFocus . childId - 1 ) === 0 ) ? null : state . canvasFocus . childId - 1 ;
609608
610- const canvasFocus = { ...state . canvasFocus , childId } ;
611609 return {
612610 ...state ,
613611 HTMLTypes,
614- components,
615- canvasFocus
612+ components
616613 } ;
617614 }
618615
You can’t perform that action at this time.
0 commit comments