perf: overflow;load history
This commit is contained in:
@@ -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 = ({
|
|||||||
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 = ({
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// refresh history
|
||||||
|
loadHistory({ pageNum: 1, init: true });
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
chatId,
|
chatId,
|
||||||
@@ -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 = ({
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user