Skip to content

Commit e150262

Browse files
committed
altered payloads for allState reducers
1 parent cdd3024 commit e150262

File tree

8 files changed

+14
-8
lines changed

8 files changed

+14
-8
lines changed

app/src/components/main/AddLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function AddLink({ id, onClickHandler, linkDisplayed }) {
3939
state.childId = id;
4040
state.attributes.compLink = event.target.value;
4141
// dispatch({type: 'UPDATE ATTRIBUTES', payload: state})
42-
dispatch(updateAttributes({attributes: state}))
42+
dispatch(updateAttributes(state))
4343
return true;
4444
}
4545
});

app/src/components/main/DemoRender.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const DemoRender = (): JSX.Element => {
6868
return el.name.toLowerCase() === component.toLowerCase();
6969
}).id;
7070
componentId &&
71-
dispatch(changeFocus({ componentId: state.canvasFocus.componentId, childId: state.canvasFocus.childId}));
71+
dispatch(changeFocus({ componentId: state.canvasFocus.componentId, childId: null}));
7272
// dispatch({
7373
// type: 'CHANGE FOCUS',
7474
// payload: { componentId, childId: null }

app/src/components/main/IndirectChild.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function IndirectChild({
2727
// type: 'CHANGE FOCUS',
2828
// payload: { componentId: linkId, childId: null }
2929
// });
30-
dispatch(changeFocus({ componentId: linkId, childId: state.canvasFocus.childId}));
30+
dispatch(changeFocus({ componentId: linkId, childId: null}));
3131
}
3232
let linkName: string;
3333
// if there's a link in this component, then include a link

app/src/components/main/RouteLink.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ function RouteLink({ childId, type, typeId, style }: ChildElement) {
4545
function onClickHandlerRoute(event) {
4646
event.stopPropagation();
4747
// changeFocus(typeId, null);
48-
dispatch(changeFocus({ componentId:typeId, childId: null}));
48+
// dispatch(changeFocus({ componentId:typeId, childId: null}));
49+
dispatch(changeFocus(typeId));
4950
}
5051
// combine all styles so that higher priority style specifications overrule lower priority style specifications
5152
// priority order is 1) style directly set for this child (style), 2) style for the routeLink component, and 3) default styling

app/src/components/main/SeparatorChild.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ function DirectChildHTMLNestable({
109109
function onClickHandler(event) {
110110
event.stopPropagation();
111111
// changeFocus(state.canvasFocus.componentId, childId);
112-
dispatch(changeFocus({ componentId: state.canvasFocus.componentId, childId: state.canvasFocus.childId}));
112+
// dispatch(changeFocus({ componentId: state.canvasFocus.componentId, childId: state.canvasFocus.childId}));
113+
dispatch(changeFocus(state.canvasFocus.componentId));
113114
}
114115

115116
// combine all styles so that higher priority style specifications overrule lower priority style specifications

app/src/components/right/ComponentPanel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ const dispatch = useDispatch();
104104
// type: 'ADD COMPONENT',
105105
// payload: { componentName: formattedName, root: isRoot }
106106
// });
107-
dispatch(addComponent({ componentName: formattedName, root: isRoot }));
107+
108+
// dispatch(addComponent( { componentName: formattedName, root: isRoot }));
109+
const component = addComponent({ componentName: formattedName, root: isRoot });
110+
dispatch(component);
111+
console.log('component:', component);
108112
// reset root toggle back to default position
109113
setIsRoot(false);
110114
// reset name field

app/src/components/right/DeleteProjects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function ProjectsDialog(props: ProjectDialogProps) {
4646
deleteProject(selectedProject);
4747
localforage.removeItem(window.localStorage.getItem('ssid'));
4848
// dispatch({ type: 'SET INITIAL STATE', payload: initialState });
49-
dispatch(setInitialState({}))
49+
dispatch(setInitialState(initialState))
5050
onClose();
5151
};
5252

app/src/components/right/OpenProjects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function ProjectsDialog(props: ProjectDialogProps) {
3737
(project: any) => project.name === value
3838
)[0];
3939
// dispatch({ type: 'OPEN PROJECT', payload: selectedProject });
40-
dispatch(openProject({selectedProject}))
40+
dispatch(openProject(selectedProject))
4141
onClose();
4242
};
4343
return (

0 commit comments

Comments
 (0)