Skip to content

Commit 6eca4d3

Browse files
authored
Merge pull request #1032 from dacadeorg/fix/refresh-challenge-on-locale-change
fix: refresh challenge and submission page after locale change
2 parents 2c33ebc + af6b6fe commit 6eca4d3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/pages/communities/[slug]/challenges/[challenge_id]/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export default function ChallengePage() {
7070
const title = useMemo(() => getMetadataTitle(t("communities.challenge.title"), challenge?.name || ""), [challenge?.name, t]);
7171

7272
const navigation = useNavigation();
73-
const router = useRouter();
74-
const { challenge_id, slug, locale } = router.query;
73+
const { query, locale } = useRouter();
74+
const { challenge_id, slug } = query;
7575

7676
const initPage = useCallback(async () => {
7777
const fetchPayload = {
@@ -88,7 +88,7 @@ export default function ChallengePage() {
8888
setChallenge(challenge);
8989
dispatch(initChallengeNavigationMenu(navigation.community));
9090
setLoading(false);
91-
}, [challenge_id, slug]);
91+
}, [challenge_id, slug, locale]);
9292

9393
useEffect(() => {
9494
initPage();

src/pages/communities/[slug]/challenges/[challenge_id]/submissions/[submission_id].tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export default function SubmissionPage() {
2323
const dispatch = useDispatch();
2424
const { t } = useTranslation();
2525
const navigation = useNavigation();
26-
const router = useRouter();
27-
const { slug, locale, submission_id, challenge_id } = router.query;
26+
const { query, locale } = useRouter();
27+
const { slug, submission_id, challenge_id } = query;
2828
const [loading, setLoading] = useState(true);
2929
const { current } = useSelector((state) => state.submissions);
3030

@@ -41,7 +41,7 @@ export default function SubmissionPage() {
4141
]);
4242
dispatch(initChallengeNavigationMenu(navigation.community));
4343
setLoading(false);
44-
}, [slug, submission_id]);
44+
}, [slug, submission_id, locale]);
4545

4646
useEffect(() => {
4747
initPage();

0 commit comments

Comments
 (0)