From f9f17a7d37a341a331e9eafe6d1268e3198aa8c8 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Sat, 12 Dec 2020 16:09:38 +0200 Subject: [PATCH] router replace instead of router push --- components/u/AvatarWithInfo.tsx | 33 ++++++++++++++++----------------- pages/_app.tsx | 1 - pages/player/[id].tsx | 2 +- pages/u/index.tsx | 4 ++-- pages/xsearch/[[...slug]].tsx | 2 +- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/components/u/AvatarWithInfo.tsx b/components/u/AvatarWithInfo.tsx index 3855500d6..eb0924e05 100644 --- a/components/u/AvatarWithInfo.tsx +++ b/components/u/AvatarWithInfo.tsx @@ -162,23 +162,22 @@ const AvatarWithInfo: React.FC = ({ )} - {process.env.NODE_ENV === "development" && - Object.keys(peakLeaguePowers).length > 0 && ( - - {(["TWIN", "QUAD"] as LeagueType[]) - .filter((type) => peakLeaguePowers[type]) - .map((type) => ( - - - - {type} - {peakLeaguePowers[type]} - - - - ))} - - )} + {Object.keys(peakLeaguePowers).length > 0 && ( + + {(["TWIN", "QUAD"] as LeagueType[]) + .filter((type) => peakLeaguePowers[type]) + .map((type) => ( + + + + {type} + {peakLeaguePowers[type]} + + + + ))} + + )} {!!user.player?.switchAccountId && ( { - console.log(`Loading: ${url}`); NProgress.start(); }); Router.events.on("routeChangeComplete", () => NProgress.done()); diff --git a/pages/player/[id].tsx b/pages/player/[id].tsx index b0757b36a..93c9f7650 100644 --- a/pages/player/[id].tsx +++ b/pages/player/[id].tsx @@ -38,7 +38,7 @@ const PlayerPage = (props: Props) => { { - router.push( + router.replace( `/player/${player.switchAccountId}/?tab=${value}`, undefined, { diff --git a/pages/u/index.tsx b/pages/u/index.tsx index 0678fba46..e7d11220a 100644 --- a/pages/u/index.tsx +++ b/pages/u/index.tsx @@ -35,9 +35,9 @@ const UserSearchPage = ({ users }: Props) => { useEffect(() => { if (debouncedFilter.length < 3) { - router.push(`/u`, undefined, { shallow: true }); + router.replace(`/u`, undefined, { shallow: true }); } else { - router.push( + router.replace( `/u?filter=${encodeURIComponent(debouncedFilter)}`, undefined, { diff --git a/pages/xsearch/[[...slug]].tsx b/pages/xsearch/[[...slug]].tsx index d20acc526..64baace80 100644 --- a/pages/xsearch/[[...slug]].tsx +++ b/pages/xsearch/[[...slug]].tsx @@ -32,7 +32,7 @@ const XSearchPage = ({ placements, monthOptions }: Props) => { const router = useRouter(); useEffect(() => { - router.push( + router.replace( `/xsearch/${variables.year}/${variables.month}/${variables.mode}` ); }, [variables]);