Skip to content

Commit 3c20a26

Browse files
author
john lim
committed
reducer changes
1 parent 0e4983a commit 3c20a26

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/reducers/componentReducer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,20 @@ const reducer = (state: State, action: Action) => {
437437

438438
case 'DELETE PAGE': {
439439
const id: number = state.canvasFocus.componentId;
440-
const components: Component[] = deleteById(id);
440+
const name: string = state.components[id - 1].name;
441+
442+
const components: Component[] = deleteById(id, name);
441443
// rebuild rootComponents with correct page IDs
442444
const rootComponents = updateRoots(components);
443445
const canvasFocus = { componentId: 1, childId: null };
444446
return { ...state, rootComponents, components, canvasFocus };
445447
}
446448
case 'DELETE REUSABLE COMPONENT': {
447449
const id: number = state.canvasFocus.componentId;
450+
const name: string = state.components[id - 1].name;
451+
448452
// updated list of components after deleting a component
449-
const components: Component[] = deleteById(id);
453+
const components: Component[] = deleteById(id, name);
450454
const rootComponents: number[] = updateRoots(components);
451455

452456
// iterate over the length of the components array

0 commit comments

Comments
 (0)