Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

The crm-app example had MSW infrastructure but lacked documentation and runtime parity with msw-todo. Developers couldn't easily use it for frontend debugging without a backend.

Changes

  • Documentation: Added README.md and QUICKSTART.md covering architecture, setup, and debugging
  • Runtime: Removed dev-only MSW gate in main.tsx - now runs in all modes like msw-todo
  • Build config: Added MSW optimizeDeps to vite.config.ts for proper browser bundling
  • Error handling: Bootstrap now catches and displays failures with readable error UI

Before/After

// Before - MSW only in development
if (process.env.NODE_ENV === 'development') {
  await startMockServer();
}
await initClient();

// After - MSW always active, with error handling
await startMockServer();
await initClient();
// ...
.catch(err => {
  console.error("FATAL: Application failed to start", err);
  document.body.innerHTML = `<div style="color:red; padding: 20px;">...`;
});

Both examples now use identical pattern: Browser → MSW Service Worker → ObjectStack Kernel (in-memory) → InMemoryDriver

Original prompt

examples参考 todo-app, 把 crm-app改为msw加载模式,以便在前端调试和测试API


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Jan 29, 2026

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

Project Deployment Review Updated (UTC)
objectui Ready Ready Preview, Comment Jan 29, 2026 11:30am
objectui-components Ready Ready Preview, Comment Jan 29, 2026 11:30am
objectui-crm-app Error Error Jan 29, 2026 11:30am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update crm-app to msw loading mode for API testing Align crm-app with msw-todo pattern for frontend-first development Jan 29, 2026
Copilot AI requested a review from hotlong January 29, 2026 07:48
Copilot AI and others added 4 commits January 29, 2026 07:54
- Add eslint-plugin-storybook to fix lint errors
- Fix import path in msw-todo (use correct package name)
- Add exports field to todo package for config file
- Add plugin-form and plugin-grid to pretest build steps

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…k 8.x

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1760.07KB 416.42KB
core (index.js) 0.51KB 0.28KB
data-objectstack (index.js) 4.42KB 1.47KB
fields (index.js) 75.69KB 15.58KB
layout (index.js) 12.63KB 3.91KB
plugin-aggrid (AgGridImpl-DKkq6v1B.js) 5.09KB 1.84KB
plugin-aggrid (index-B6NPAFZx.js) 15.66KB 4.51KB
plugin-aggrid (index.js) 0.18KB 0.15KB
plugin-calendar (index.js) 33.12KB 8.29KB
plugin-charts (AdvancedChartImpl-DPXnchtJ.js) 69.51KB 16.23KB
plugin-charts (BarChart-RKJxvg5Y.js) 535.74KB 134.11KB
plugin-charts (ChartImpl-DZGXB6YY.js) 8.78KB 3.11KB
plugin-charts (index-A3NiI95J.js) 12.59KB 3.90KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-chatbot (index.js) 18.36KB 5.21KB
plugin-dashboard (index.js) 11.92KB 3.81KB
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-form (index.js) 14.43KB 4.64KB
plugin-gantt (index.js) 18.00KB 5.26KB
plugin-grid (index.js) 15.94KB 5.02KB
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-map (index.js) 16.75KB 5.11KB
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
plugin-timeline (index.js) 23.90KB 5.95KB
plugin-view (index.js) 16.64KB 4.92KB
react (SchemaRenderer.js) 2.58KB 1.04KB
react (index.js) 0.36KB 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 (field-types.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

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1760.07KB 416.42KB
core (index.js) 0.51KB 0.28KB
data-objectstack (index.js) 4.42KB 1.47KB
fields (index.js) 75.69KB 15.58KB
layout (index.js) 12.63KB 3.91KB
plugin-aggrid (AgGridImpl-DKkq6v1B.js) 5.09KB 1.84KB
plugin-aggrid (index-B6NPAFZx.js) 15.66KB 4.51KB
plugin-aggrid (index.js) 0.18KB 0.15KB
plugin-calendar (index.js) 33.12KB 8.29KB
plugin-charts (AdvancedChartImpl-DPXnchtJ.js) 69.51KB 16.23KB
plugin-charts (BarChart-RKJxvg5Y.js) 535.74KB 134.11KB
plugin-charts (ChartImpl-DZGXB6YY.js) 8.78KB 3.11KB
plugin-charts (index-A3NiI95J.js) 12.59KB 3.90KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-chatbot (index.js) 18.36KB 5.21KB
plugin-dashboard (index.js) 11.92KB 3.81KB
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-form (index.js) 14.43KB 4.64KB
plugin-gantt (index.js) 18.00KB 5.26KB
plugin-grid (index.js) 15.94KB 5.02KB
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-map (index.js) 16.75KB 5.11KB
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
plugin-timeline (index.js) 23.90KB 5.95KB
plugin-view (index.js) 16.64KB 4.92KB
react (SchemaRenderer.js) 2.58KB 1.04KB
react (index.js) 0.36KB 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 (field-types.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

@github-actions
Copy link

✅ All checks passed!

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

Copilot AI and others added 6 commits January 29, 2026 11:14
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1760.07KB 416.42KB
core (index.js) 0.51KB 0.28KB
data-objectstack (index.js) 4.42KB 1.47KB
fields (index.js) 75.69KB 15.58KB
layout (index.js) 12.63KB 3.91KB
plugin-aggrid (AgGridImpl-DKkq6v1B.js) 5.09KB 1.84KB
plugin-aggrid (index-B6NPAFZx.js) 15.66KB 4.51KB
plugin-aggrid (index.js) 0.18KB 0.15KB
plugin-calendar (index.js) 33.12KB 8.29KB
plugin-charts (AdvancedChartImpl-DPXnchtJ.js) 69.51KB 16.23KB
plugin-charts (BarChart-RKJxvg5Y.js) 535.74KB 134.11KB
plugin-charts (ChartImpl-DZGXB6YY.js) 8.78KB 3.11KB
plugin-charts (index-A3NiI95J.js) 12.59KB 3.90KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-chatbot (index.js) 18.36KB 5.21KB
plugin-dashboard (index.js) 11.92KB 3.81KB
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-form (index.js) 14.43KB 4.64KB
plugin-gantt (index.js) 18.00KB 5.26KB
plugin-grid (index.js) 15.94KB 5.02KB
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-map (index.js) 16.75KB 5.11KB
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
plugin-timeline (index.js) 23.90KB 5.95KB
plugin-view (index.js) 16.64KB 4.92KB
react (SchemaRenderer.js) 2.58KB 1.04KB
react (index.js) 0.36KB 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 (field-types.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

@github-actions
Copy link

✅ All checks passed!

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

Copilot AI and others added 3 commits January 29, 2026 11:33
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Jan 29, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: objectui-components.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel
Copy link

vercel bot commented Jan 29, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: objectui.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel
Copy link

vercel bot commented Jan 29, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: objectui-crm-app.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1760.07KB 416.42KB
core (index.js) 0.51KB 0.28KB
data-objectstack (index.js) 4.42KB 1.47KB
fields (index.js) 75.69KB 15.58KB
layout (index.js) 12.63KB 3.91KB
plugin-aggrid (AgGridImpl-DKkq6v1B.js) 5.09KB 1.84KB
plugin-aggrid (index-B6NPAFZx.js) 15.66KB 4.51KB
plugin-aggrid (index.js) 0.18KB 0.15KB
plugin-calendar (index.js) 33.12KB 8.29KB
plugin-charts (AdvancedChartImpl-DPXnchtJ.js) 69.51KB 16.23KB
plugin-charts (BarChart-RKJxvg5Y.js) 535.74KB 134.11KB
plugin-charts (ChartImpl-DZGXB6YY.js) 8.78KB 3.11KB
plugin-charts (index-A3NiI95J.js) 12.59KB 3.90KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-chatbot (index.js) 18.36KB 5.21KB
plugin-dashboard (index.js) 11.92KB 3.81KB
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-form (index.js) 14.43KB 4.64KB
plugin-gantt (index.js) 18.00KB 5.26KB
plugin-grid (index.js) 15.94KB 5.02KB
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-map (index.js) 16.75KB 5.11KB
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
plugin-timeline (index.js) 23.90KB 5.95KB
plugin-view (index.js) 16.64KB 4.92KB
react (SchemaRenderer.js) 2.58KB 1.04KB
react (index.js) 0.36KB 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 (field-types.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

@hotlong hotlong marked this pull request as ready for review January 29, 2026 12:21
Copilot AI review requested due to automatic review settings January 29, 2026 12:21
@hotlong hotlong merged commit 99e27f0 into main Jan 29, 2026
9 of 13 checks passed
@github-actions
Copy link

✅ All checks passed!

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

Copy link
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 aligns the crm-app example with the msw-todo pattern so both can be run and debugged entirely from the frontend against an in-browser ObjectStack runtime, and tightens Storybook/testing tooling around these flows.

Changes:

  • Enabled MSW-powered in-browser ObjectStack kernels for crm-app in all modes (not just development), matching the msw-todo bootstrap pattern and adding robust startup error handling.
  • Updated build and tooling config (Vite, Storybook, ESLint plugins, test-runner) plus Storybook stories to use the real @object-ui/react runtime and to support MSW scenarios cleanly.
  • Added detailed documentation (README.md, QUICKSTART.md) for the crm-app MSW workflow and wired example packages (@object-ui/example-crm, @object-ui/example-todo) for direct consumption by the MSW examples.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Syncs lockfile to include new dev tooling (eslint-plugin-storybook, @storybook/csf, updated Jest/esbuild wiring, vitest snapshot metadata) required by the Storybook test-runner and ESLint plugin additions.
packages/components/src/ui/sidebar.tsx Adjusts SidebarMenuSkeleton to use useState for a stable random width per instance instead of useMemo, changing core UI primitive logic in the sidebar skeleton.
packages/components/src/stories-json/page.stories.tsx Switches JSON-based Page story to use SchemaRenderer and SchemaRendererProvider from @object-ui/react, ensuring stories exercise the real runtime with an explicit dataSource.
packages/components/src/stories-json/object-view.stories.tsx Same as above for Object View stories: they now render via SchemaRendererProvider and SchemaRenderer from @object-ui/react with a dummy dataSource.
packages/components/src/stories-json/object-grid.stories.tsx Same pattern for Object Grid JSON stories, wiring through SchemaRendererProvider and the runtime renderer.
packages/components/src/renderers/data-display/statistic.tsx Clarifies the dynamic Lucide icon lookup with @ts-expect-error and an ESLint disable comment so the renderer can safely resolve arbitrary icon names at runtime.
packages/components/src/custom/native-select.tsx Adds an explicit eslint-disable-next-line @typescript-eslint/no-empty-object-type for the empty NativeSelectProps interface to keep linting clean while retaining the flexible prop surface.
packages/components/src/SchemaRenderer.tsx Documents and lint-suppresses the dynamic component resolution from the registry when rendering <Component />, making the intent explicit to ESLint.
package.json Extends the top-level pretest pipeline to build @object-ui/plugin-form and @object-ui/plugin-grid, and adds eslint-plugin-storybook as a devDependency for Storybook-specific linting rules.
examples/todo/package.json Marks the todo example package as ESM and adds an export for ./objectstack.config, enabling imports like @object-ui/example-todo/objectstack.config from other workspaces (e.g., msw-todo).
examples/msw-todo/src/mocks/browser.ts Points the MSW kernel at @object-ui/example-todo/objectstack.config (matching the package name/exports) instead of the old @objectstack/example-todo path.
examples/msw-todo/src/main.tsx Wraps the async bootstrap() call in a .catch with a simple fatal error UI, aligning the error-handling pattern with crm-app while still starting MSW before rendering.
examples/crm-app/vite.config.ts Adds optimizeDeps includes for MSW and ObjectStack spec packages plus build/rollupOptions tweaks to handle CommonJS and suppress a known optional @objectstack/driver-memory dynamic import warning, matching the msw-todo setup.
examples/crm-app/src/main.tsx Simplifies and hardens the bootstrap: always starts the MSW mock server (all modes), then initializes the ObjectStack client, and adds a fatal error fallback UI identical to msw-todo.
examples/crm-app/README.md Introduces comprehensive documentation for the crm-app MSW architecture and flow: browser → MSW → ObjectStack Kernel → in-memory driver, client wiring, seeding, and how to migrate the configuration to production backends.
examples/crm-app/QUICKSTART.md Adds a step-by-step quickstart detailing how to run the CRM demo, inspect MSW/kernel logs, modify schema/data, and debug API calls and mocked data flows.
.storybook/test-runner.ts Configures Storybook test-runner with a preVisit hook that sets window.__test = true in the browser context to avoid __test is not defined errors during story smoke tests.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

}

// This is dynamic component resolution from registry, not component creation during render
// eslint-disable-next-line
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

Using a bare /* eslint-disable-next-line */ here disables all rules on this line, which can mask unrelated lint issues later. To keep ESLint coverage tight and consistent with the rest of the codebase (e.g. page.tsx and native-select.tsx), consider scoping this to the specific rule you need to suppress (such as the React "no component in render" rule) instead of a blanket disable.

Suggested change
// eslint-disable-next-line
// eslint-disable-next-line react/no-unstable-nested-components

Copilot uses AI. Check for mistakes.
</p>
)}
{/* Dynamic icon resolution from Lucide, not component creation during render */}
{/* eslint-disable-next-line */}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

Similar to SchemaRenderer.tsx, this uses a bare /* eslint-disable-next-line */, which disables all lint rules for the JSX line. For maintainability, it would be better to target the specific rule you’re intentionally bypassing (e.g. the React rule about components created in render) so that other potential problems on this line are still caught by ESLint.

Suggested change
{/* eslint-disable-next-line */}
{/* eslint-disable-next-line react/no-unstable-nested-components */}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants