From 27d2d405dd17951b6bda261f92cfd285c349d931 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 13 Dec 2023 06:45:48 +1100 Subject: [PATCH] Fix for quickly switching between tabs --- .../challenge-listing/ChallengeTab/index.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/shared/components/challenge-listing/ChallengeTab/index.jsx b/src/shared/components/challenge-listing/ChallengeTab/index.jsx index 11f18a703..901c81a9a 100644 --- a/src/shared/components/challenge-listing/ChallengeTab/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeTab/index.jsx @@ -67,7 +67,9 @@ const ChallengeTab = ({ if (currentTabName === TAB_NAME.ACTIVE_CHALLENGES) { return; } - setPreviousBucketOfPastChallengesTab(activeBucket); + if (past) { + setPreviousBucketOfPastChallengesTab(activeBucket); + } setCurrentSelected(0); setIsTabClosed(true); let selectedBucket = ''; @@ -90,6 +92,11 @@ const ChallengeTab = ({ if (currentTabName === TAB_NAME.INNOVATION_CHALLENGE) { return; } + if (!past) { + setPreviousBucketOfActiveTab(activeBucket); + } else { + setPreviousBucketOfPastChallengesTab(activeBucket); + } setFilterState({ ..._.cloneDeep(filterState), isInnovationChallenge: 'true', @@ -102,7 +109,9 @@ const ChallengeTab = ({ if (currentTabName === TAB_NAME.PAST_CHALLENGES) { return; } - setPreviousBucketOfActiveTab(activeBucket); + if (!past) { + setPreviousBucketOfActiveTab(activeBucket); + } setCurrentSelected(1); setIsTabClosed(true); let selectedBucket = '';