mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
Merge pull request #1173 from SohamBhattacharjee2003/perf/lazy-load-mobile-panels
Perf: lazy load mobile panels
This commit is contained in:
commit
46ef0db8ab
1 changed files with 14 additions and 40 deletions
|
|
@ -8,6 +8,7 @@ import {
|
||||||
} from "@assistant-ui/react";
|
} from "@assistant-ui/react";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { useAtomValue, useSetAtom } from "jotai";
|
import { useAtomValue, useSetAtom } from "jotai";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
@ -37,48 +38,21 @@ import { removeChatTabAtom, updateChatTabTitleAtom } from "@/atoms/tabs/tabs.ato
|
||||||
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
|
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
|
||||||
import { ThinkingStepsDataUI } from "@/components/assistant-ui/thinking-steps";
|
import { ThinkingStepsDataUI } from "@/components/assistant-ui/thinking-steps";
|
||||||
import { Thread } from "@/components/assistant-ui/thread";
|
import { Thread } from "@/components/assistant-ui/thread";
|
||||||
import { MobileEditorPanel } from "@/components/editor-panel/editor-panel";
|
|
||||||
import { MobileHitlEditPanel } from "@/components/hitl-edit-panel/hitl-edit-panel";
|
|
||||||
import { MobileReportPanel } from "@/components/report-panel/report-panel";
|
|
||||||
import { useChatSessionStateSync } from "@/hooks/use-chat-session-state";
|
|
||||||
import { useMessagesSync } from "@/hooks/use-messages-sync";
|
|
||||||
import { documentsApiService } from "@/lib/apis/documents-api.service";
|
|
||||||
import { getBearerToken } from "@/lib/auth-utils";
|
|
||||||
import { convertToThreadMessage } from "@/lib/chat/message-utils";
|
|
||||||
import {
|
|
||||||
isPodcastGenerating,
|
|
||||||
looksLikePodcastRequest,
|
|
||||||
setActivePodcastTaskId,
|
|
||||||
} from "@/lib/chat/podcast-state";
|
|
||||||
import {
|
|
||||||
addToolCall,
|
|
||||||
appendText,
|
|
||||||
buildContentForPersistence,
|
|
||||||
buildContentForUI,
|
|
||||||
type ContentPartsState,
|
|
||||||
FrameBatchedUpdater,
|
|
||||||
readSSEStream,
|
|
||||||
type ThinkingStepData,
|
|
||||||
updateThinkingSteps,
|
|
||||||
updateToolCall,
|
|
||||||
} from "@/lib/chat/streaming-state";
|
|
||||||
import {
|
|
||||||
appendMessage,
|
|
||||||
createThread,
|
|
||||||
getRegenerateUrl,
|
|
||||||
getThreadFull,
|
|
||||||
getThreadMessages,
|
|
||||||
type ThreadRecord,
|
|
||||||
} from "@/lib/chat/thread-persistence";
|
|
||||||
import { NotFoundError } from "@/lib/error";
|
|
||||||
import {
|
|
||||||
trackChatCreated,
|
|
||||||
trackChatError,
|
|
||||||
trackChatMessageSent,
|
|
||||||
trackChatResponseReceived,
|
|
||||||
} from "@/lib/posthog/events";
|
|
||||||
import Loading from "../loading";
|
import Loading from "../loading";
|
||||||
|
|
||||||
|
const MobileEditorPanel = dynamic(
|
||||||
|
() => import("@/components/editor-panel/editor-panel").then((m) => ({ default: m.MobileEditorPanel })),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
const MobileHitlEditPanel = dynamic(
|
||||||
|
() => import("@/components/hitl-edit-panel/hitl-edit-panel").then((m) => ({ default: m.MobileHitlEditPanel })),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
const MobileReportPanel = dynamic(
|
||||||
|
() => import("@/components/report-panel/report-panel").then((m) => ({ default: m.MobileReportPanel })),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After a tool produces output, mark any previously-decided interrupt tool
|
* After a tool produces output, mark any previously-decided interrupt tool
|
||||||
* calls as completed so the ApprovalCard can transition from shimmer to done.
|
* calls as completed so the ApprovalCard can transition from shimmer to done.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue