Skip to content

Commit

Permalink
perf: overflow;load history
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed May 9, 2023
1 parent 4dc541e commit 9b68388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Layout = ({ children, isPcDevice }: { children: JSX.Element; isPcDevice: b

return (
<>
<Box h={'100%'} overflowY={'auto'} bg={'gray.100'}>
<Box h={'100%'} bg={'gray.100'}>
{isPc ? (
pcUnShowLayoutRoute[router.pathname] ? (
<Auth>{children}</Auth>
Expand Down
10 changes: 4 additions & 6 deletions src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ const Chat = ({
if (newChatId) {
setForbidLoadChatData(true);
router.replace(`/chat?modelId=${modelId}&chatId=${newChatId}`);
loadHistory({ pageNum: 1, init: true });
}
} catch (err) {
toast({
Expand All @@ -222,6 +221,9 @@ const Chat = ({
};
})
}));

// refresh history
loadHistory({ pageNum: 1, init: true });
},
[
chatId,
Expand Down Expand Up @@ -488,10 +490,6 @@ const Chat = ({
modelId && setLastChatModelId(modelId);
setLastChatId(chatId);

/* get mode and chat into ↓ */

// phone: history page
if (!isPc && Object.keys(router.query).length === 0) return null;
if (forbidLoadChatData) {
setForbidLoadChatData(false);
return null;
Expand Down Expand Up @@ -566,7 +564,7 @@ const Chat = ({
try {
setIsLoading(true);
await onclickDelHistory(chatData.chatId);
router.replace(`/chat`);
router.replace(`/chat?modelId=${modelId}`);
} catch (err) {
console.log(err);
}
Expand Down

0 comments on commit 9b68388

Please sign in to comment.