Skip to content

Commit 55de283

Browse files
committed
added env and working on slices
1 parent 9f0712c commit 55de283

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app/src/interfaces/Interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export interface AddRoutes {
107107
}
108108

109109
export interface ManageSeparators {
110-
mergeSeparator: (arg1:[], arg2:number) => void; // fix the void
111-
handleSeparators: (arg1: [], arg2?: string) => void; // fix the void
110+
mergeSeparator: (arg1:any, arg2:any) => any; // update specificity
111+
handleSeparators: (arg1: any, arg2?: any) => any; // update specificity
112112
nextTopSeparatorId: number
113113
}

app/src/redux/reducers/slice/appStateSlice.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,13 @@ const appStateSlice = createSlice({
608608
components,
609609
state.canvasFocus.componentId
610610
);
611+
if (component && state.canvasFocus.childId) {
611612
const targetChild = findChild(component, state.canvasFocus.childId);
612613
const event = Object.keys(events)[0];
613614
const funcName = events[event];
615+
if (targetChild) {
614616
targetChild.events[event] = funcName;
615-
617+
616618
component.code = generateCode(
617619
components,
618620
state.canvasFocus.componentId,
@@ -623,6 +625,8 @@ const appStateSlice = createSlice({
623625
action.payload.contextParam
624626
);
625627
state.components = components;
628+
}
629+
}
626630
},
627631

628632
deleteEventAction: (state, action) => {
@@ -632,9 +636,11 @@ const appStateSlice = createSlice({
632636
components,
633637
state.canvasFocus.componentId
634638
);
639+
if (component && state.canvasFocus.childId) {
635640
const targetChild = findChild(component, state.canvasFocus.childId);
641+
if (targetChild) {
636642
delete targetChild.events[event];
637-
643+
638644
component.code = generateCode(
639645
components,
640646
state.canvasFocus.componentId,
@@ -645,6 +651,8 @@ const appStateSlice = createSlice({
645651
action.payload.contextParam
646652
);
647653
state.components = components;
654+
}
655+
}
648656
},
649657

650658
deletePage: (state, action) => {
@@ -827,11 +835,13 @@ const appStateSlice = createSlice({
827835
(state.canvasFocus.childId === childIdDeleteClicked ||
828836
JSON.stringify(action.payload.id) === '{}') // Ensuring deletion works for mouseclick OR using delete key, from 2 different dispatch sources
829837
) {
838+
if (directParent.children) {
830839
directParent.children.splice(childIndexValue, 1);
831840
let nextTopSeparatorId = manageSeparators.handleSeparators(
832841
components[canvasFocus.componentId - 1].children,
833842
'delete'
834843
);
844+
}
835845
}
836846

837847
// ------------------------------------------- ALSO added code above -------------------------------------------

0 commit comments

Comments
 (0)