Merge pull request #16295 from Bouncey/fix/duplicateKeys

fix(step-challenge): Fix duplicate keys in Step
pull/16392/merge
Berkeley Martinez 2018-01-01 12:57:33 -08:00 committed by GitHub
commit 540b0ec4d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 17 deletions

View File

@ -167,23 +167,24 @@ export class StepChallenge extends PureComponent {
);
}
renderStep({
clickOnImage,
completeAction,
currentIndex,
isActionCompleted,
isLastStep,
numOfSteps,
step,
stepBackward,
stepForward
renderStep(
{
clickOnImage,
completeAction,
currentIndex,
isActionCompleted,
isLastStep,
numOfSteps,
step,
stepBackward,
stepForward
}) {
if (!Array.isArray(step)) {
return null;
}
const [imgUrl, imgAlt, info, action] = step;
return (
<div key={ imgUrl }>
<div key={ `${info.slice(0, 15)}` }>
<a
href={ imgUrl }
onClick={ clickOnImage }
@ -241,8 +242,8 @@ export class StepChallenge extends PureComponent {
if (!Array.isArray(steps)) {
return null;
}
return steps.map(([ imgUrl, imgAlt ]) => (
<div key={ imgUrl }>
return steps.map(([ imgUrl, imgAlt, info ]) => (
<div key={ `${info.slice(0, 15)}` }>
<Image
alt={ imgAlt }
responsive={ true }

View File

@ -63,10 +63,7 @@ export const actionCompletedSelector = state => getNS(state).isActionCompleted;
export default handleActions(
() => ({
[challenges.challengeUpdated]: () => {
console.log('updating step ui');
return initialState;
},
[challenges.challengeUpdated]: () => initialState,
[types.goToStep]: (state, { payload: { step = 0, isUnlocked }}) => ({
...state,
currentIndex: step,