Commit 9b683884 by archer

perf: overflow;load history

parent 4dc541e0
...@@ -35,7 +35,7 @@ const Layout = ({ children, isPcDevice }: { children: JSX.Element; isPcDevice: b ...@@ -35,7 +35,7 @@ const Layout = ({ children, isPcDevice }: { children: JSX.Element; isPcDevice: b
return ( return (
<> <>
<Box h={'100%'} overflowY={'auto'} bg={'gray.100'}> <Box h={'100%'} bg={'gray.100'}>
{isPc ? ( {isPc ? (
pcUnShowLayoutRoute[router.pathname] ? ( pcUnShowLayoutRoute[router.pathname] ? (
<Auth>{children}</Auth> <Auth>{children}</Auth>
......
...@@ -198,7 +198,6 @@ const Chat = ({ ...@@ -198,7 +198,6 @@ const Chat = ({
if (newChatId) { if (newChatId) {
setForbidLoadChatData(true); setForbidLoadChatData(true);
router.replace(`/chat?modelId=${modelId}&chatId=${newChatId}`); router.replace(`/chat?modelId=${modelId}&chatId=${newChatId}`);
loadHistory({ pageNum: 1, init: true });
} }
} catch (err) { } catch (err) {
toast({ toast({
...@@ -222,6 +221,9 @@ const Chat = ({ ...@@ -222,6 +221,9 @@ const Chat = ({
}; };
}) })
})); }));
// refresh history
loadHistory({ pageNum: 1, init: true });
}, },
[ [
chatId, chatId,
...@@ -488,10 +490,6 @@ const Chat = ({ ...@@ -488,10 +490,6 @@ const Chat = ({
modelId && setLastChatModelId(modelId); modelId && setLastChatModelId(modelId);
setLastChatId(chatId); setLastChatId(chatId);
/* get mode and chat into ↓ */
// phone: history page
if (!isPc && Object.keys(router.query).length === 0) return null;
if (forbidLoadChatData) { if (forbidLoadChatData) {
setForbidLoadChatData(false); setForbidLoadChatData(false);
return null; return null;
...@@ -566,7 +564,7 @@ const Chat = ({ ...@@ -566,7 +564,7 @@ const Chat = ({
try { try {
setIsLoading(true); setIsLoading(true);
await onclickDelHistory(chatData.chatId); await onclickDelHistory(chatData.chatId);
router.replace(`/chat`); router.replace(`/chat?modelId=${modelId}`);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment