Skip to content

Commit

Permalink
#505 Undo/redo is broken in vector selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriána Kohanová committed Jan 25, 2021
1 parent 4efbbee commit 5e695a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
13 changes: 4 additions & 9 deletions js/components/preview/compounds/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ export const handleClickOnCompound = ({ event, data, majorViewStage, index }) =>
}

if (isSelectedID !== undefined) {
await dispatch(removeSelectedCompoundClass(index));
dispatch(removeSelectedCompoundClass(index));
dispatch(removeFromToBuyList(data, index));
} else {
await dispatch(addSelectedCompoundClass(currentCompoundClass, index));
dispatch(appendToBuyList(Object.assign({}, data, { class: currentCompoundClass })), index);
dispatch(addSelectedCompoundClass(currentCompoundClass, index));
dispatch(appendToBuyList(Object.assign({}, data, { class: currentCompoundClass }), index));
}
}
};
Expand All @@ -234,12 +234,7 @@ export const handleBuyListAll = ({ isSelected, items, majorViewStage }) => (disp
if (isSelected === false) {
dispatch(clearCompounds(items, majorViewStage));
} else {
for (var item in items) {
let index = item.compoundId;
dispatch(appendToBuyList(item, index, true));
dispatch(addSelectedCompoundClass(item.class, index));
}
dispatch(appendToBuyListAll(items));
dispatch(selectAllCompounds());
}
};

Expand Down
4 changes: 2 additions & 2 deletions js/reducers/tracking/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1424,10 +1424,10 @@ const handleRedoAction = (action, stages) => (dispatch, getState) => {
dispatch(handleVectorAction(action, false));
break;
case actionType.VECTOR_COUMPOUND_ADDED:
dispatch(handleVectorCompoundAction(action, true));
dispatch(handleVectorCompoundAction(action, true, majorViewStage));
break;
case actionType.VECTOR_COUMPOUND_REMOVED:
dispatch(handleVectorCompoundAction(action, false));
dispatch(handleVectorCompoundAction(action, false, majorViewStage));
break;
case actionType.CLASS_SELECTED:
dispatch(handleClassSelectedAction(action, true));
Expand Down
4 changes: 2 additions & 2 deletions js/reducers/tracking/trackingActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export const findTrackAction = (action, state) => {
object_type: objectType,
object_name: objectName,
object_id: objectName,
compoundId: action.item.compoundId,
compoundId: action.index,
item: action.item,
text: `${actionDescription.VECTOR} ${objectName} ${actionDescription.ADDED} ${actionDescription.TO_SHOPPING_CART}`
};
Expand All @@ -391,7 +391,7 @@ export const findTrackAction = (action, state) => {
object_type: objectType,
object_name: objectName,
object_id: objectName,
compoundId: action.item.compoundId,
compoundId: action.index,
item: action.item,
text: `${actionDescription.VECTOR} ${objectName} ${actionDescription.REMOVED} ${actionDescription.FROM_SHOPPING_CART}`
};
Expand Down

0 comments on commit 5e695a2

Please sign in to comment.