Skip to content

Commit e1769c1

Browse files
committed
next build fixes
1 parent ca7dc79 commit e1769c1

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

website/src/pages/chat/[id].tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import { get } from "src/lib/api";
88
import { ModelInfo, PluginEntry } from "src/types/Chat";
99
export { getServerSideProps } from "src/lib/defaultServerSideProps";
1010
import useSWRImmutable from "swr/immutable";
11-
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";
1211

1312
const Chat = () => {
14-
const { BYE } = useBrowserConfig();
1513
const router = useRouter();
1614
const { query } = router;
1715
const id = query.id as string;
@@ -23,11 +21,6 @@ const Chat = () => {
2321
keepPreviousData: true,
2422
});
2523

26-
if (BYE) {
27-
router.push("/bye");
28-
return null;
29-
}
30-
3124
return (
3225
<>
3326
<Head>

website/src/pages/chat/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import Head from "next/head";
2+
import { useRouter } from "next/router";
23
import { useTranslation } from "next-i18next";
34
import React from "react";
45
import { ChatListBase } from "src/components/Chat/ChatListBase";
56
import { DashboardLayout } from "src/components/Layout";
67
export { getStaticProps } from "src/lib/defaultServerSideProps";
8+
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";
79

810
const ChatList = () => {
911
const { t } = useTranslation();
12+
const { BYE } = useBrowserConfig();
13+
const router = useRouter();
14+
15+
React.useEffect(() => {
16+
if (BYE) {
17+
router.push("/bye");
18+
}
19+
}, [router, BYE]);
1020

1121
return (
1222
<>

website/src/pages/contributors.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { useRouter } from "next/router";
2+
import { useEffect } from "react";
23

34
const ContributorsPage = () => {
45
const router = useRouter();
5-
router.push("https://ykilcher.com/oa-contributors");
6+
useEffect(() => {
7+
router.push("https://ykilcher.com/oa-contributors");
8+
}, [router]);
9+
610
return null;
711
};
812

website/src/pages/dashboard.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Button, Card, CardBody, Flex, Heading } from "@chakra-ui/react";
22
import Head from "next/head";
3+
import { useRouter } from "next/router";
34
import { useTranslation } from "next-i18next";
4-
import { useMemo } from "react";
5+
import { useEffect, useMemo } from "react";
56
import { LeaderboardWidget, TaskOption, WelcomeCard } from "src/components/Dashboard";
67
import { DashboardLayout } from "src/components/Layout";
78
import { get } from "src/lib/api";
@@ -14,7 +15,6 @@ import { useBrowserConfig } from "src/hooks/env/BrowserEnv";
1415
import { useCurrentLocale } from "src/hooks/locale/useCurrentLocale";
1516
import { API_ROUTES } from "src/lib/routes";
1617
import useSWR from "swr";
17-
import { useRouter } from "next/router";
1818

1919
const Dashboard = () => {
2020
const { t } = useTranslation(["dashboard", "common", "tasks"]);
@@ -57,10 +57,11 @@ const Dashboard = () => {
5757
},
5858
};
5959

60-
if (BYE) {
61-
router.push("/bye");
62-
return null;
63-
}
60+
useEffect(() => {
61+
if (BYE) {
62+
router.push("/bye");
63+
}
64+
}, [BYE, router]);
6465

6566
return (
6667
<>

website/src/pages/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ const Home = () => {
1616
const { status } = useSession();
1717
const { t } = useTranslation();
1818
useEffect(() => {
19+
if (BYE) {
20+
router.push("/bye");
21+
}
22+
1923
if (status === "authenticated") {
2024
router.push("/dashboard");
2125
}
22-
}, [router, status]);
23-
24-
if (BYE) {
25-
router.push("/bye");
26-
return null;
27-
}
26+
}, [router, status, BYE]);
2827

2928
return (
3029
<>

0 commit comments

Comments
 (0)