From 939e6bbd68bad2b0fe51a3dc597930458964ffba Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 10 Jul 2022 12:32:29 +0300 Subject: [PATCH] Fix seeing other users' badges on route change --- app/routes/u.$identifier/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/routes/u.$identifier/index.tsx b/app/routes/u.$identifier/index.tsx index bf445dd02..c8746c568 100644 --- a/app/routes/u.$identifier/index.tsx +++ b/app/routes/u.$identifier/index.tsx @@ -114,6 +114,12 @@ function SocialLinkIcon({ type }: Pick) { function BadgeContainer(props: { badges: UserPageLoaderData["badges"] }) { const [badges, setBadges] = React.useState(props.badges); + + // keep badges in sync when route changes from one user profile to another + React.useEffect(() => { + setBadges(props.badges); + }, [props.badges]); + const [bigBadge, ...smallBadges] = badges; if (!bigBadge) return null;