forked from XiaoMo/ChatGPT-Next-Web
performance: introduce lazy-loading for ChatList
Reduce the first load JS bundle size using next/dynamic.
This commit is contained in:
parent
301cbbfdfb
commit
f920b2001d
@ -19,7 +19,6 @@ import CloseIcon from "../icons/close.svg";
|
||||
import { useChatStore } from "../store";
|
||||
import { isMobileScreen } from "../utils";
|
||||
import Locale from "../locales";
|
||||
import { ChatList } from "./chat-list";
|
||||
import { Chat } from "./chat";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
@ -39,6 +38,10 @@ const Settings = dynamic(async () => (await import("./settings")).Settings, {
|
||||
loading: () => <Loading noLogo />,
|
||||
});
|
||||
|
||||
const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, {
|
||||
loading: () => <Loading noLogo />,
|
||||
});
|
||||
|
||||
function useSwitchTheme() {
|
||||
const config = useChatStore((state) => state.config);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user