Add AG Grid plugin with lazy loading and peer dependency architecture#172
Add AG Grid plugin with lazy loading and peer dependency architecture#172
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/xuyushun441-sys-projects?upgradeToPro=build-rate-limit |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
📦 Bundle Size Report
Size Limits
|
|
✅ All checks passed!
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new AG Grid plugin package (@object-ui/plugin-aggrid) that integrates AG Grid Community Edition into the ObjectUI component ecosystem using a lazy-loading architecture with peer dependencies.
Changes:
- Implements lazy-loaded AG Grid component with React.Suspense for optimal bundle splitting
- Configures AG Grid libraries as peer dependencies to prevent version conflicts
- Adds comprehensive test coverage for component registry metadata
- Provides extensive documentation including usage examples and API reference
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
packages/plugin-aggrid/package.json |
Package configuration with peer dependencies and build scripts |
packages/plugin-aggrid/vite.config.ts |
Build configuration externalizing AG Grid libraries |
packages/plugin-aggrid/tsconfig.json |
TypeScript configuration following plugin conventions |
packages/plugin-aggrid/src/types.ts |
TypeScript interfaces for AgGridSchema and column definitions |
packages/plugin-aggrid/src/index.tsx |
Entry point with lazy loading wrapper and component registration |
packages/plugin-aggrid/src/AgGridImpl.tsx |
Heavy implementation with AG Grid imports and theme support |
packages/plugin-aggrid/src/index.test.ts |
Unit tests for component registry metadata |
packages/plugin-aggrid/README.md |
Comprehensive documentation with usage examples |
packages/plugin-aggrid/CHANGELOG.md |
Initial release changelog |
pnpm-lock.yaml |
Dependency lock file updates with AG Grid packages |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| }, | ||
| "devDependencies": { | ||
| "@types/react": "^19.0.6", | ||
| "@types/react-dom": "^19.0.3", |
There was a problem hiding this comment.
The @types/react-dom version is set to 19.0.3, which is inconsistent with other plugin packages (plugin-charts and plugin-kanban use ^18.3.1). While React 19 is supported in peerDependencies, the devDependencies should align with the established pattern for consistency. Consider using ^18.3.1 or updating all plugins consistently to use React 19 types.
| react: | ||
| specifier: 19.2.3 | ||
| version: 19.2.3 | ||
| react-dom: | ||
| specifier: 19.2.3 | ||
| version: 19.2.3(react@19.2.3) |
There was a problem hiding this comment.
react and react-dom are listed in the dependencies section of pnpm-lock.yaml, which is inconsistent with the peer dependency architecture used by other plugins. This occurs because package.json incorrectly lists them in dependencies. These should only appear in peerDependencies to avoid bundling React twice and causing version conflicts.
|
|
||
| ## Advanced Usage | ||
|
|
||
| ### With GridOptions | ||
|
|
||
| ```typescript |
There was a problem hiding this comment.
The valueFormatter example uses an arrow function, which cannot be serialized to JSON. This contradicts ObjectUI's JSON-first Schema-Driven UI principle where all component configurations should be representable as pure JSON. While AG Grid supports functions in columnDefs, in a truly schema-driven architecture, formatters should be referenced by string identifiers or use expression syntax instead of inline functions. Consider documenting how valueFormatter should be handled in a JSON schema context, or note this as a limitation that requires programmatic configuration.
| columnDefs: [ | ||
| { field: 'make', headerName: 'Make', sortable: true, filter: true }, | ||
| { field: 'model', headerName: 'Model', sortable: true, filter: true }, | ||
| { | ||
| field: 'price', | ||
| headerName: 'Price', | ||
| sortable: true, | ||
| filter: 'number', | ||
| valueFormatter: (params: any) => params.value != null ? '$' + params.value.toLocaleString() : '' | ||
| }, | ||
| { | ||
| field: 'electric', | ||
| headerName: 'Electric', | ||
| sortable: true, | ||
| filter: true, | ||
| cellRenderer: (params: any) => params.value === true ? '⚡ Yes' : 'No' | ||
| } |
There was a problem hiding this comment.
The defaultProps include arrow functions in valueFormatter and cellRenderer fields (lines 183 and 190), which violates ObjectUI's JSON-first principle. Arrow functions cannot be serialized to JSON, making these defaults unusable in a true schema-driven context. According to the coding guidelines (Rule #3: The Action System), all behaviors should be defined as data, not functions. Consider either: (1) removing these function-based defaults and documenting that formatters must be added programmatically, or (2) implementing a string-based renderer/formatter system that can be referenced by name in JSON.
| "dependencies": { | ||
| "@object-ui/components": "workspace:*", | ||
| "@object-ui/core": "workspace:*", | ||
| "@object-ui/react": "workspace:*", | ||
| "@object-ui/types": "workspace:*" | ||
| }, |
There was a problem hiding this comment.
react and react-dom should not be listed in dependencies when they are already declared as peerDependencies. This creates bundling issues and version conflicts. Following the established pattern in plugin-charts and plugin-kanban, these packages should only be in peerDependencies, not in dependencies. Remove them from the dependencies section.
| "ag-grid-react": "^32.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/react": "^19.0.6", |
There was a problem hiding this comment.
The @types/react version is set to 19.0.6, which is inconsistent with other plugin packages (plugin-charts and plugin-kanban use ^18.3.12). While React 19 is in the peerDependencies as an option (^18.0.0 || ^19.0.0), the devDependencies should align with the established pattern for consistency. Consider using ^18.3.12 or updating all plugins consistently to use React 19 types.
Implements
@object-ui/plugin-aggridpackage integrating AG Grid Community Edition into the ObjectUI component ecosystem.Implementation
AgGridImpl.tsx(heavy imports) andindex.tsx(lightweight wrapper with React.Suspense), ensuring AG Grid libraries load only when grid component rendersag-grid-communityandag-grid-reactto prevent version conflicts and reduce bundle size (10.28 KB vs 894 KB if bundled)aggridtype with ComponentRegistry on importAgGridSchemaandSimpleColumnDefinterfaces for type safetyUsage
Package Structure
Follows established plugin pattern from
plugin-chartsandplugin-kanban.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.