@@ -608,11 +608,13 @@ const appStateSlice = createSlice({
608
608
components ,
609
609
state . canvasFocus . componentId
610
610
) ;
611
+ if ( component && state . canvasFocus . childId ) {
611
612
const targetChild = findChild ( component , state . canvasFocus . childId ) ;
612
613
const event = Object . keys ( events ) [ 0 ] ;
613
614
const funcName = events [ event ] ;
615
+ if ( targetChild ) {
614
616
targetChild . events [ event ] = funcName ;
615
-
617
+
616
618
component . code = generateCode (
617
619
components ,
618
620
state . canvasFocus . componentId ,
@@ -623,6 +625,8 @@ const appStateSlice = createSlice({
623
625
action . payload . contextParam
624
626
) ;
625
627
state . components = components ;
628
+ }
629
+ }
626
630
} ,
627
631
628
632
deleteEventAction : ( state , action ) => {
@@ -632,9 +636,11 @@ const appStateSlice = createSlice({
632
636
components ,
633
637
state . canvasFocus . componentId
634
638
) ;
639
+ if ( component && state . canvasFocus . childId ) {
635
640
const targetChild = findChild ( component , state . canvasFocus . childId ) ;
641
+ if ( targetChild ) {
636
642
delete targetChild . events [ event ] ;
637
-
643
+
638
644
component . code = generateCode (
639
645
components ,
640
646
state . canvasFocus . componentId ,
@@ -645,6 +651,8 @@ const appStateSlice = createSlice({
645
651
action . payload . contextParam
646
652
) ;
647
653
state . components = components ;
654
+ }
655
+ }
648
656
} ,
649
657
650
658
deletePage : ( state , action ) => {
@@ -827,11 +835,13 @@ const appStateSlice = createSlice({
827
835
( state . canvasFocus . childId === childIdDeleteClicked ||
828
836
JSON . stringify ( action . payload . id ) === '{}' ) // Ensuring deletion works for mouseclick OR using delete key, from 2 different dispatch sources
829
837
) {
838
+ if ( directParent . children ) {
830
839
directParent . children . splice ( childIndexValue , 1 ) ;
831
840
let nextTopSeparatorId = manageSeparators . handleSeparators (
832
841
components [ canvasFocus . componentId - 1 ] . children ,
833
842
'delete'
834
843
) ;
844
+ }
835
845
}
836
846
837
847
// ------------------------------------------- ALSO added code above -------------------------------------------
0 commit comments