perf: lazy-load DocumentTabContent to reduce initial dashboard bundle…#1273
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on 2b2453e..be2e011
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (1)
• surfsense_web/components/layout/ui/shell/LayoutShell.tsx
This PR implements dynamic importing (lazy-loading) for the
DocumentTabContentcomponent within theLayoutShell.Description
DocumentTabContentwithnext/dynamic.Spinnerfor better perceived performance.ssr: falsefor this component to prevent potential hydration issues with the heavy editor dependencies (Plate/KaTeX).Motivation and Context
The dashboard shell was previously pulling in heavy dependencies (Plate editor, MarkdownViewer, KaTeX, etc.) even for users who only used the chat. By lazy-loading the document content, we significantly reduce the initial bundle size of the dashboard.
FIX #1242
Screenshots
API Changes
Change Type
Testing Performed
Checklist
Note: Used --no-verify for commit due to existing lint errors in the main branch.
@MODSetter
High-level PR Summary
This PR implements lazy-loading for the
DocumentTabContentcomponent usingnext/dynamicto reduce the initial dashboard bundle size. By deferring the load of heavy editor dependencies (Plate editor, MarkdownViewer, KaTeX) until the document tab is actually accessed, users who only interact with chat features no longer need to download these unnecessary dependencies. The change includes a loading spinner for better user experience during component loading and disables SSR to prevent potential hydration issues with the editor dependencies.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/components/layout/ui/shell/LayoutShell.tsxSummary by CodeRabbit