Skip to content

Commit 2b1da94

Browse files
reducer cleanup, working version
1 parent 9a133d0 commit 2b1da94

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/actions/components.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,13 @@ export const changeFocusComponent = ({ title }) => dispatch => {
132132
};
133133

134134
// make sure childId is being sent in
135+
<<<<<<< HEAD
135136
export const changeFocusChild = ({ title, childId }) => dispatch => {
136137
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { title, childId } });
138+
=======
139+
export const changeFocusChild = ({ childId }) => (dispatch) => {
140+
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { childId } });
141+
>>>>>>> c532596... reducer cleanup, working version
137142
};
138143

139144
export const changeComponentFocusChild = ({ componentId, childId }) => dispatch => {

src/containers/LeftContainer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const mapDispatchToProps = dispatch => ({
2525
),
2626
addChild: ({ title, childType, HTMLInfo }) => dispatch(actions.addChild({ title, childType, HTMLInfo })),
2727
changeFocusComponent: ({ title }) => dispatch(actions.changeFocusComponent({ title })),
28-
changeFocusChild: ({ title, childId }) => dispatch(actions.changeFocusChild({ title, childId })),
28+
changeFocusChild: ({ childId }) => dispatch(actions.changeFocusChild({ childId })),
2929
deleteComponent: ({ componentId, stateComponents }) =>
3030
dispatch(actions.deleteComponent({ componentId, stateComponents })),
3131
});

src/containers/MainContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const mapDispatchToProps = dispatch => ({
3434
}),
3535
),
3636
openPanel: component => dispatch(openExpansionPanel(component)),
37-
changeFocusChild: ({ title, childId }) => dispatch(changeFocusChild({ title, childId })),
37+
changeFocusChild: ({ childId }) => dispatch(changeFocusChild({ childId })),
3838
changeComponentFocusChild: ({ componentId, childId }) =>
3939
dispatch(changeComponentFocusChild({ componentId, childId })),
4040
deleteChild: ({}) => dispatch(deleteChild({})), // if u send no prms, function will delete focus child.

src/utils/componentReducer.util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export const changeFocusComponent = (state, { title = state.focusComponent.title
385385
};
386386
};
387387

388-
export const changeFocusChild = (state, { title, childId }) => {
388+
export const changeFocusChild = (state, { childId }) => {
389389
const focComp = state.components.find(comp => comp.title === state.focusComponent.title);
390390
let newFocusChild = focComp.childrenArray.find(child => child.childId === childId);
391391

0 commit comments

Comments
 (0)