mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
Merge pull request #1062 from JoeMakuta/optimize/dynamic-video-tool-import
feat: dynamically import video presentation tool to optimize bundle size
This commit is contained in:
commit
5783646dea
1 changed files with 10 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import {
|
||||||
useAui,
|
useAui,
|
||||||
useAuiState,
|
useAuiState,
|
||||||
} from "@assistant-ui/react";
|
} from "@assistant-ui/react";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import {
|
import {
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
|
|
@ -77,12 +78,20 @@ import {
|
||||||
resolveSafeNavigationHref,
|
resolveSafeNavigationHref,
|
||||||
} from "@/components/tool-ui/shared/media";
|
} from "@/components/tool-ui/shared/media";
|
||||||
import { RecallMemoryToolUI, SaveMemoryToolUI } from "@/components/tool-ui/user-memory";
|
import { RecallMemoryToolUI, SaveMemoryToolUI } from "@/components/tool-ui/user-memory";
|
||||||
import { GenerateVideoPresentationToolUI } from "@/components/tool-ui/video-presentation";
|
|
||||||
import { Drawer, DrawerContent, DrawerHandle, DrawerHeader, DrawerTitle } from "@/components/ui/drawer";
|
import { Drawer, DrawerContent, DrawerHandle, DrawerHeader, DrawerTitle } from "@/components/ui/drawer";
|
||||||
import { useComments } from "@/hooks/use-comments";
|
import { useComments } from "@/hooks/use-comments";
|
||||||
import { useMediaQuery } from "@/hooks/use-media-query";
|
import { useMediaQuery } from "@/hooks/use-media-query";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
// Dynamically import video presentation tool to avoid loading Babel and Remotion in main bundle
|
||||||
|
const GenerateVideoPresentationToolUI = dynamic(
|
||||||
|
() =>
|
||||||
|
import("@/components/tool-ui/video-presentation").then((m) => ({
|
||||||
|
default: m.GenerateVideoPresentationToolUI,
|
||||||
|
})),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
|
||||||
function extractDomain(url: string): string | undefined {
|
function extractDomain(url: string): string | undefined {
|
||||||
try {
|
try {
|
||||||
return new URL(url).hostname.replace(/^www\./, "");
|
return new URL(url).hostname.replace(/^www\./, "");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue