router replace instead of router push

This commit is contained in:
Kalle (Sendou) 2020-12-12 16:09:38 +02:00
parent 2e8e027ae7
commit f9f17a7d37
5 changed files with 20 additions and 22 deletions

View File

@ -162,23 +162,22 @@ const AvatarWithInfo: React.FC<AvatarWithInfoProps> = ({
</Flex>
)}
{process.env.NODE_ENV === "development" &&
Object.keys(peakLeaguePowers).length > 0 && (
<Flex mt={4}>
{(["TWIN", "QUAD"] as LeagueType[])
.filter((type) => peakLeaguePowers[type])
.map((type) => (
<Fragment key={type}>
<Flex align="center" justify="center" mx={2}>
<Box ml={2} color={gray}>
<SubText>{type}</SubText>
{peakLeaguePowers[type]}
</Box>
</Flex>
</Fragment>
))}
</Flex>
)}
{Object.keys(peakLeaguePowers).length > 0 && (
<Flex mt={4}>
{(["TWIN", "QUAD"] as LeagueType[])
.filter((type) => peakLeaguePowers[type])
.map((type) => (
<Fragment key={type}>
<Flex align="center" justify="center" mx={2}>
<Box ml={2} color={gray}>
<SubText>{type}</SubText>
{peakLeaguePowers[type]}
</Box>
</Flex>
</Fragment>
))}
</Flex>
)}
<Box width="100%" textAlign="center" mt={4}>
{!!user.player?.switchAccountId && (
<MyLink

View File

@ -18,7 +18,6 @@ import "./styles.css";
NProgress.configure({ showSpinner: false });
Router.events.on("routeChangeStart", (url) => {
console.log(`Loading: ${url}`);
NProgress.start();
});
Router.events.on("routeChangeComplete", () => NProgress.done());

View File

@ -38,7 +38,7 @@ const PlayerPage = (props: Props) => {
<RadioGroup
onChange={(value) => {
router.push(
router.replace(
`/player/${player.switchAccountId}/?tab=${value}`,
undefined,
{

View File

@ -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,
{

View File

@ -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]);