You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Task: Refactor Monorepo to Support Lazy-Loaded Plugins #31
I have an existing pnpm workspace with packages/react (Core) and packages/components (Standard Lib).
Now I need to split heavy components into separate Plugin Packages and implement Internal Lazy Loading to optimize bundle size.
1. New Directory Structure
Please create two new packages in packages/:
packages/plugin-editor:
Purpose: A code editor component.
Simulated Heavy Dependency:@monaco-editor/react.
Schema Type:code-editor.
packages/plugin-charts:
Purpose: A charting component.
Simulated Heavy Dependency:recharts (or simply simulate a large file).
Schema Type:chart-bar.
2. ⚡️ The Lazy Loading Pattern (CRITICAL)
Do NOT force the Host App to use React.lazy. The plugin itself must handle the lazy loading internally.
Implementation Requirement for each plugin:
HeavyImpl.tsx: The actual component that imports the heavy library (e.g., Monaco).
index.tsx: The entry point. It must use React.lazy to import HeavyImpl.tsx and wrap it in <React.Suspense>.
Example Code Structure (for plugin-editor):
// packages/plugin-editor/src/MonacoImpl.tsximportEditorfrom'@monaco-editor/react';// 👈 The heavy import happens hereexportdefaultfunctionMonacoImpl(props){ ... }// packages/plugin-editor/src/index.tsximportReact,{Suspense}from'react';import{Skeleton}from'@object-ui/components';// Reuse skeleton from standard lib// 🚀 Lazy load the implementation fileconstLazyEditor=React.lazy(()=>import('./MonacoImpl'));exportconstCodeEditorRenderer=(props)=>(<Suspensefallback={<SkeletonclassName="h-64 w-full bg-slate-100"/>}><LazyEditor{...props}/></Suspense>);// Standard Export ProtocolexportconsteditorComponents={'code-editor': CodeEditorRenderer};3.ExecutionSteps*CreatePackages: Initializeplugin-editorandplugin-chartswithpackage.jsonandtsconfig.json.*ImplementLazyLogic: Applythepatterndescribedabovetobothplugins.*Forplugin-charts,createamock"Heavy Chart"componentifyoudon't want to install recharts yet, but ensure the React.lazy structure is used.*ExportRegistry: Ensurepackage.jsonmainpointstosrc/index.ts(ordist).*UpdatePlayground:
*Gotoapps/playground.*Adddependencies: pnpmadd @object-ui/plugin-editor @object-ui/plugin-charts--workspace.*InApp.tsx,importeditorComponentsandchartComponents.*MergethemintotheSchemaRenderercomponentsprop:
constregistry={ ...standardComponents, ...editorComponents, ...chartComponents};4.VerificationCreateatestschemainthePlaygroundcontaining{"type": "code-editor"}.Verifythattheheavychunk(Monaco/Charts)isNOTloadedoninitialpageload,butonlyloadedwhenthecomponentisrendered.
Activity
feat: implement ListView Spec Protocol gap fixes (Phase 1-3)
fix: resolve I18nLabel objects in MetricWidget and MetricCard to prev…
fix(app-shell,core): keep error-envelope objects out of toast.error —…
Resolve merge conflicts for #2575 (merge main into claude/github-issu…
fix(actions): a failed server action no longer reports as success (gr…
fix(actions): one source for the /actions envelope rule, and redirect…
fix(actions): read objectstack#3962's single-wrapped /actions respons…
fix(console): a flow or action that failed under HTTP 200 stops repor…
fix(components): page:header resolves a lookup title candidate instea…
fix(console): resolve a form entry's inline locale map to the visitor…