generated from cording12/next-fast-turbo
-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Description
The PlateEditor (rich text editor with many plugins) is statically imported in several panel components that are hidden behind user interactions (clicking "Edit", opening reports, etc.). This adds ~200KB+ to the route chunk even though most users never open these panels in a given session.
Vercel React Best Practices Rule: bundle-dynamic-imports (2.4)
Files to change
surfsense_web/components/editor-panel/editor-panel.tsxsurfsense_web/components/report-panel/report-panel.tsxsurfsense_web/components/hitl-edit-panel/hitl-edit-panel.tsx
What to do
For each file, replace the static import of PlateEditor with a dynamic import:
import dynamic from "next/dynamic";
import { Skeleton } from "@/components/ui/skeleton";
const PlateEditor = dynamic(
() => import("@/components/editor/plate-editor").then(m => ({ default: m.PlateEditor })),
{ ssr: false, loading: () => <Skeleton className="h-64 w-full" /> }
);Also check RightPanel.tsx — if it directly imports EditorPanel, ReportPanel, or HitlEditPanel, those imports should also be dynamic since the right panel starts collapsed.
Acceptance criteria
- PlateEditor loads on demand when a panel is opened
- A skeleton/loading state shows briefly while the editor loads
- Editor functionality (typing, formatting, saving) works after loading
- Main chat page bundle size is reduced (verify with
next build)
Reactions are currently unavailable