mirror of https://github.com/buster-so/buster.git
prefetch chat home
This commit is contained in:
parent
9f052724d3
commit
a052036440
|
@ -65,7 +65,7 @@ export const ChatResponseReasoning: React.FC<{
|
|||
}, [isReasonginFileSelected, messageId, chatId]);
|
||||
|
||||
return (
|
||||
<Link href={href}>
|
||||
<Link href={href} prefetch>
|
||||
<AnimatePresence initial={!isCompletedStream} mode="wait">
|
||||
<motion.div
|
||||
{...animations}
|
||||
|
|
|
@ -6,6 +6,9 @@ import { useChatLayoutContextSelector } from '../../ChatLayoutContext';
|
|||
import { FileContainerHeaderVersionHistory } from './FileContainerHeaderVersionHistory';
|
||||
import { SelectedFileButtonsRecord, SelectedFileSegmentRecord } from './config';
|
||||
import { FileType } from '@/api/asset_interfaces/chat';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useMount } from '@/hooks';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
|
||||
export const FileContainerHeader: React.FC = React.memo(() => {
|
||||
const selectedFileType = useChatLayoutContextSelector((x) => x.selectedFile?.type);
|
||||
|
@ -28,6 +31,7 @@ const FileContainerHeaderStandard: React.FC<{
|
|||
selectedFileId: string | undefined;
|
||||
selectedFileType: FileType | undefined;
|
||||
}> = ({ selectedFileId, selectedFileType }) => {
|
||||
const router = useRouter();
|
||||
const chatId = useChatLayoutContextSelector((x) => x.chatId);
|
||||
const selectedFileView = useChatLayoutContextSelector((x) => x.selectedFileView);
|
||||
const onCollapseFileClick = useChatLayoutContextSelector((state) => state.onCollapseFileClick);
|
||||
|
@ -50,6 +54,17 @@ const FileContainerHeaderStandard: React.FC<{
|
|||
[selectedFileType]
|
||||
);
|
||||
|
||||
useMount(() => {
|
||||
if (chatId) {
|
||||
router.prefetch(
|
||||
createBusterRoute({
|
||||
route: BusterRoutes.APP_CHAT_ID,
|
||||
chatId
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex min-w-0 shrink items-center gap-1.5 overflow-hidden">
|
||||
|
|
Loading…
Reference in New Issue