diff --git a/src/components/Action/ActionBegin.tsx b/src/components/Action/ActionBegin.tsx index 1ba661ffb8530368585a6b61ed1dbebe6db7faac..3c528d2ae2f50b7b4b84ccf66f591a86bcbffcba 100644 --- a/src/components/Action/ActionBegin.tsx +++ b/src/components/Action/ActionBegin.tsx @@ -44,10 +44,10 @@ const ActionBegin: React.FC<ActionBeginProps> = ({ useEffect(() => { let subscribed = true - if (action) { - if (subscribed) setCurrentAction(action) - } else { - const getSingleAction = async () => { + const getAction = async () => { + if (action) { + if (subscribed) setCurrentAction(action) + } else { const actionService = new ActionService(client) let actions: Ecogesture[] = [] if (isProfileTypeCompleted) { @@ -59,12 +59,12 @@ const ActionBegin: React.FC<ActionBeginProps> = ({ setCurrentAction(actions[0]) } } - getSingleAction() } + getAction() return () => { subscribed = false } - }, [client, isProfileTypeCompleted, fluidTypes, action]) + }, [client, isProfileTypeCompleted, fluidTypes, action, currentAction]) useEffect(() => { if (currentAction) { diff --git a/src/components/Action/ActionChoose.tsx b/src/components/Action/ActionChoose.tsx index 0bac975a94cd3c42f7fcea7dcf3774d8a723b820..09f328f2fe1f25351d247ccc27b6eac747b16d0c 100644 --- a/src/components/Action/ActionChoose.tsx +++ b/src/components/Action/ActionChoose.tsx @@ -14,11 +14,9 @@ const ActionChoose: React.FC<ActionChooseProps> = ({ return ( <div className="action-choose"> - {!selectedAction && !showList ? ( - <ActionBegin setShowList={setShowList} userChallenge={userChallenge} /> - ) : selectedAction && !showList ? ( + {!showList ? ( <ActionBegin - action={selectedAction} + action={selectedAction ? selectedAction : undefined} setShowList={setShowList} userChallenge={userChallenge} /> diff --git a/src/components/Action/ActionModal.tsx b/src/components/Action/ActionModal.tsx index f4dad1ff06057a09e07f7705f68a304dabf26067..c90239f3cfb467d21111fc592bb8de61245d8e16 100644 --- a/src/components/Action/ActionModal.tsx +++ b/src/components/Action/ActionModal.tsx @@ -36,8 +36,7 @@ const ActionModal: React.FC<ActionModalProps> = ({ action ) dispatch(updateUserChallengeList(updatedChallenge)) - handleCloseClick() - }, [action, client, dispatch, userChallenge, handleCloseClick]) + }, [action, client, dispatch, userChallenge]) return ( <Modal border={false} handleCloseClick={handleCloseClick}> diff --git a/src/components/Challenge/StarsContainer.tsx b/src/components/Challenge/StarsContainer.tsx index 9ec983f71845a7ad9afc4e82c02bedce61197d59..2559ff83acb1c4de1994214d1acdcf5ff76560c1 100644 --- a/src/components/Challenge/StarsContainer.tsx +++ b/src/components/Challenge/StarsContainer.tsx @@ -13,6 +13,7 @@ const StarsContainer: React.FC<StarsContainerProps> = ({ isQuizBegin, }: StarsContainerProps) => { const [elements] = useState<string[]>([]) + useEffect(() => { const renderStars = () => { //To be removed when action and explorations will be done @@ -24,7 +25,6 @@ const StarsContainer: React.FC<StarsContainerProps> = ({ else if (i >= result) elements.push(starIcon) } } - renderStars() }, [result, elements]) diff --git a/src/components/Duel/DuelOngoing.tsx b/src/components/Duel/DuelOngoing.tsx index aa4ad6841e8bbd498854883faaaaa7b61d505993..d7f6d6f2a31ef9f092265eeb8ddedef3833cb6a9 100644 --- a/src/components/Duel/DuelOngoing.tsx +++ b/src/components/Duel/DuelOngoing.tsx @@ -9,7 +9,7 @@ import { unlockNextUserChallenge, updateUserChallengeList, } from 'store/challenge/challenge.actions' -import { toogleChallengeNotification } from 'store/global/global.actions' +import { toogleChallengeDuelNotification } from 'store/global/global.actions' import { formatNumberValues } from 'utils/utils' import { UserDuel, UserChallenge } from 'models' @@ -61,7 +61,7 @@ const DuelOngoing: React.FC<DuelOngoingProps> = ({ ) dispatch(updateUserChallengeList(updatedChallenge)) dispatch(unlockNextUserChallenge(updatedChallenge)) - dispatch(toogleChallengeNotification(false)) + dispatch(toogleChallengeDuelNotification(false)) history.push('/challenges') }, [client, dispatch, userChallenge, history, winChallenge]) diff --git a/src/components/Exploration/ExplorationFinished.tsx b/src/components/Exploration/ExplorationFinished.tsx index 5ca43d11b9eb6c3e0787eca72cf2590a7674da65..5ce36eb3d072365f7098b3ebe039105f6c81e9e5 100644 --- a/src/components/Exploration/ExplorationFinished.tsx +++ b/src/components/Exploration/ExplorationFinished.tsx @@ -38,8 +38,8 @@ const ExplorationFinished: React.FC<ExplorationFinishedProps> = ({ } }, [client, dispatch, userChallenge]) - const goBack = useCallback(() => { - checkNotificationToEnd() + const goBack = useCallback(async () => { + await checkNotificationToEnd() history.goBack() }, [history, checkNotificationToEnd])