Skip to content

Add inline data support for ObjectTable and ObjectForm to fix documentation examples#149

Merged
hotlong merged 4 commits intomainfrom
copilot/fix-loading-users-example
Jan 22, 2026
Merged

Add inline data support for ObjectTable and ObjectForm to fix documentation examples#149
hotlong merged 4 commits intomainfrom
copilot/fix-loading-users-example

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 22, 2026

Documentation examples for object-table and object-form showed "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

  • Extended ObjectTableSchema with optional data property for static/demo data
  • Made dataSource optional when inline data is provided
  • Updated ObjectTable component to:
    • Skip server fetching when data is present
    • Auto-generate columns from data structure if not explicitly defined
    • Handle delete operations for both inline and server-backed modes
  • Fixed documentation column property names (key/labelaccessorKey/header)

ObjectForm

  • Extended ObjectFormSchema with optional initialData property for static/demo data
  • Made dataSource optional when inline fields (customFields) are provided
  • Updated ObjectForm component to:
    • Skip server fetching when inline fields are present
    • Use customFields directly instead of generating from object schema
    • Handle form submission without dataSource for demo purposes
  • Fixed documentation to use customFields and added required mode property

Usage

Documentation examples now work without a server:

ObjectTable:

<InteractiveDemo
  schema={{
    type: "object-table",
    objectName: "users",
    columns: [
      { header: "Name", accessorKey: "name" },
      { header: "Email", accessorKey: "email" }
    ],
    data: [
      { id: 1, name: "Alice Johnson", email: "alice@example.com" },
      { id: 2, name: "Bob Smith", email: "bob@example.com" }
    ]
  }}
/>

ObjectForm:

<InteractiveDemo
  schema={{
    type: "object-form",
    objectName: "user",
    mode: "create",
    customFields: [
      { name: "name", label: "Full Name", type: "text", required: true },
      { name: "email", label: "Email", type: "email", required: true }
    ]
  }}
/>

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

plugin-object 在fumadocs文档中的例子一直显示Loading users...,能否在浏览器中运行虚拟的服务端


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectui-docs Error Error Jan 22, 2026 0:34am
objectui-site Ready Ready Preview, Comment Jan 22, 2026 0:34am

Request Review

@vercel vercel Bot temporarily deployed to Preview – objectui-docs January 22, 2026 11:43 Inactive
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel vercel Bot temporarily deployed to Preview – objectui-docs January 22, 2026 11:56 Inactive
Copilot AI changed the title [WIP] Fix loading users example in plugin-object documentation Add inline data support for ObjectTable to fix documentation examples Jan 22, 2026
Copilot AI requested a review from hotlong January 22, 2026 12:00
@hotlong
Copy link
Copy Markdown
Collaborator

hotlong commented Jan 22, 2026

object form 例子也在loading @copilot

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@xuyushun441-sys
Copy link
Copy Markdown
Contributor

@copilot 继续

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot 继续

Fixed in commit efc116d. Both ObjectTable and ObjectForm now support inline data without requiring a server.

ObjectForm Screenshot:
Working ObjectForm

The form now renders immediately with fields for Full Name, Email Address, Role, and Status.

Copilot AI changed the title Add inline data support for ObjectTable to fix documentation examples Add inline data support for ObjectTable and ObjectForm to fix documentation examples Jan 22, 2026
Copilot AI requested a review from xuyushun441-sys January 22, 2026 12:54
@hotlong hotlong marked this pull request as ready for review January 22, 2026 12:58
Copilot AI review requested due to automatic review settings January 22, 2026 12:58
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jan 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1548.04KB 364.64KB
core (index.js) 0.53KB 0.28KB
data-objectql (ObjectQLDataSource.js) 11.05KB 2.64KB
data-objectql (hooks.js) 5.62KB 1.43KB
data-objectql (index.js) 0.62KB 0.36KB
designer (index.js) 1.46KB 0.51KB
plugin-charts (AdvancedChartImpl-DazADGz5.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-DVw_7KEd.js) 3.17KB 1.10KB
plugin-charts (index-CdgY2AuM.js) 12.39KB 3.83KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-B7ZgZJJG.js) 18.15KB 5.59KB
plugin-editor (index-Dl3HAAqu.js) 10.07KB 3.31KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-CUWM-JC-.js) 76.50KB 20.46KB
plugin-kanban (index-BV3FWhCb.js) 11.86KB 3.67KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-BRkYjVWf.js) 256.79KB 64.50KB
plugin-markdown (index-D_CdfEXQ.js) 9.59KB 3.16KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.44KB 0.73KB
react (index.js) 0.32KB 0.23KB
react (index.test.js) 0.34KB 0.26KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 0.20KB 0.18KB
types (base.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data.js) 0.20KB 0.18KB
types (disclosure.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (index.js) 0.34KB 0.25KB
types (layout.js) 0.20KB 0.18KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (registry.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and initialData (ObjectForm) properties for static/demo content
  • Made dataSource optional 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[];
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
data?: any[];
data?: Record<string, unknown>[];

Copilot uses AI. Check for mistakes.
* 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>;
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
initialData?: Record<string, any>;
initialData?: Record<string, unknown>;

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +125
setObjectSchema({
name: schema.objectName,
fields: {} as Record<string, any>,
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an empty object with type assertion bypasses type safety. Consider using a more explicit type or ensuring this minimal schema has proper typing.

Suggested change
setObjectSchema({
name: schema.objectName,
fields: {} as Record<string, any>,
const inlineFields: Record<string, unknown> = {};
setObjectSchema({
name: schema.objectName,
fields: inlineFields,

Copilot uses AI. Check for mistakes.
// Use a minimal schema for inline fields
setObjectSchema({
name: schema.objectName,
fields: {} as Record<string, any>,
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an empty object with type assertion bypasses type safety. Consider using a more explicit type or ensuring this minimal schema has proper typing.

Suggested change
fields: {} as Record<string, any>,
fields: {} satisfies Record<string, any>,

Copilot uses AI. Check for mistakes.

fieldsToShow.forEach((fieldName) => {
generatedColumns.push({
header: fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/_/g, ' '),
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@hotlong hotlong merged commit 0e0a97e into main Jan 22, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation package: types plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants