Skip to content

Commit f920b20

Browse files
committed
performance: introduce lazy-loading for ChatList
Reduce the first load JS bundle size using next/dynamic.
1 parent 301cbbf commit f920b20

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/components/home.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import CloseIcon from "../icons/close.svg";
1919
import { useChatStore } from "../store";
2020
import { isMobileScreen } from "../utils";
2121
import Locale from "../locales";
22-
import { ChatList } from "./chat-list";
2322
import { Chat } from "./chat";
2423

2524
import dynamic from "next/dynamic";
@@ -39,6 +38,10 @@ const Settings = dynamic(async () => (await import("./settings")).Settings, {
3938
loading: () => <Loading noLogo />,
4039
});
4140

41+
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
42+
loading: () => <Loading noLogo />,
43+
});
44+
4245
function useSwitchTheme() {
4346
const config = useChatStore((state) => state.config);
4447

0 commit comments

Comments
 (0)