Conversation
|
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>
|
object form 例子也在loading @copilot |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 继续 |
📦 Bundle Size Report
Size Limits
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for inline data to ObjectTable and ObjectForm components, enabling documentation examples to render immediately without requiring an ObjectQL server connection.
Changes:
- Extended schemas with optional
data(ObjectTable) andinitialData(ObjectForm) properties for static/demo content - Made
dataSourceoptional when inline data/fields are provided - Updated components to skip server fetching and work with inline data
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| packages/types/src/objectql.ts | Added data property to ObjectTableSchema and initialData property to ObjectFormSchema for inline data support |
| packages/plugin-object/src/ObjectTable.tsx | Implemented inline data mode with auto-column generation and conditional server fetching |
| packages/plugin-object/src/ObjectForm.tsx | Implemented inline fields mode with direct field usage and conditional server fetching |
| docs/plugins/plugin-object.mdx | Fixed documentation examples to use correct property names and added inline data demonstrations |
| * When provided, the table will use this data instead of fetching from a data source. | ||
| * Useful for documentation examples and prototyping. | ||
| */ | ||
| data?: any[]; |
There was a problem hiding this comment.
The any[] type is too permissive. Consider defining a more specific type or using a generic type parameter to ensure type safety for the inline data structure.
| data?: any[]; | |
| data?: Record<string, unknown>[]; |
| * When provided along with customFields (or inline field definitions), the form can work without a data source. | ||
| * Useful for documentation examples and prototyping. | ||
| */ | ||
| initialData?: Record<string, any>; |
There was a problem hiding this comment.
The Record<string, any> type is too permissive. Consider using a generic type parameter or defining a more specific type to improve type safety for initial data values.
| initialData?: Record<string, any>; | |
| initialData?: Record<string, unknown>; |
| setObjectSchema({ | ||
| name: schema.objectName, | ||
| fields: {} as Record<string, any>, |
There was a problem hiding this comment.
Using an empty object with type assertion bypasses type safety. Consider using a more explicit type or ensuring this minimal schema has proper typing.
| setObjectSchema({ | |
| name: schema.objectName, | |
| fields: {} as Record<string, any>, | |
| const inlineFields: Record<string, unknown> = {}; | |
| setObjectSchema({ | |
| name: schema.objectName, | |
| fields: inlineFields, |
| // Use a minimal schema for inline fields | ||
| setObjectSchema({ | ||
| name: schema.objectName, | ||
| fields: {} as Record<string, any>, |
There was a problem hiding this comment.
Using an empty object with type assertion bypasses type safety. Consider using a more explicit type or ensuring this minimal schema has proper typing.
| fields: {} as Record<string, any>, | |
| fields: {} satisfies Record<string, any>, |
|
|
||
| fieldsToShow.forEach((fieldName) => { | ||
| generatedColumns.push({ | ||
| header: fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/_/g, ' '), |
There was a problem hiding this comment.
The header generation logic (capitalize first letter, replace underscores with spaces) is duplicated in the column generation logic elsewhere in the file. Consider extracting this into a helper function to improve maintainability.
|
✅ All checks passed!
|

Documentation examples for
object-tableandobject-formshowed "Loading users..." and "Loading form..." indefinitely because both components always attempted to fetch from an ObjectQL server that doesn't exist in browser-only contexts.Changes
ObjectTable
dataproperty for static/demo datadatais presentkey/label→accessorKey/header)ObjectForm
initialDataproperty for static/demo datacustomFields) are providedcustomFieldsdirectly instead of generating from object schemacustomFieldsand added requiredmodepropertyUsage
Documentation examples now work without a server:
ObjectTable:
ObjectForm:
Result
ObjectTable - renders immediately with inline data:
ObjectForm - renders immediately with inline field definitions:
Both components now render immediately with inline data. Backward compatible—existing server-backed usage unchanged.
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.