Skip to content
Snippets Groups Projects
Commit d4ecb875 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

fix: state issue on ChallengeCardOnGoing

parent 65ce4c96
Branches
Tags
No related merge requests found
......@@ -80,9 +80,18 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
}
useEffect(() => {
importIconbyId(userChallenge.id, 'challenge').then(icon => {
icon ? setChallengeIcon(icon) : setChallengeIcon(defaultChallengeIcon)
})
let subscribed = true
async function importIcon() {
importIconbyId(userChallenge.id, 'challenge').then(icon => {
if (subscribed) {
icon ? setChallengeIcon(icon) : setChallengeIcon(defaultChallengeIcon)
}
})
}
importIcon()
return () => {
subscribed = false
}
}, [userChallenge])
useEffect(() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment