Skip to content

fix: re-attach listViews to object metadata stripped by defineStack() Zod parse#532

Merged
hotlong merged 3 commits intomainfrom
copilot/fix-calendar-view-issue-yet-again
Feb 16, 2026
Merged

fix: re-attach listViews to object metadata stripped by defineStack() Zod parse#532
hotlong merged 3 commits intomainfrom
copilot/fix-calendar-view-issue-yet-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

Calendar view at /apps/crm_app/event/view/calendar renders as a grid table instead of the calendar component. The console receives objects without listViews from the API, so ObjectView falls back to a single default grid view.

Root cause

defineStack() validates config via ObjectStackDefinitionSchema.safeParse(). The spec's ObjectSchema does not include listViews (views live at stack level in ViewSchema), so Zod strips them. mergeViewsIntoObjects() in objectstack.shared.ts correctly merges views into objects, but the default export passes through defineStack() which discards them.

sharedConfig.objects  →  has listViews ✓
defineStack(sharedConfig)  →  listViews stripped by Zod ✗
protocol.getMetaItems('object')  →  no listViews ✗

Changes

  • handlers.tscreateHandlers accepts optional StackConfig param; builds a listViewsByObject lookup and enriches /meta/object responses via enrichObject() helper
  • browser.ts / server.ts — Import named sharedConfig (pre-defineStack, listViews intact) and pass to createHandlers

Before:
before

After:
after

Original prompt

拉取请求: #526

还是没解决日历试图看到的还是列表

https://demo.objectui.org/apps/crm_app/event/view/calendar


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 16, 2026

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

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 16, 2026 1:13am
objectui-demo Ready Ready Preview, Comment Feb 16, 2026 1:13am
objectui-storybook Ready Ready Preview, Comment Feb 16, 2026 1:13am

Request Review

The ObjectStack runtime protocol strips listViews from object metadata
during Zod validation in defineStack(). The MSW handlers now re-attach
listViews from the pre-defineStack sharedConfig so the console can
resolve named views (calendar, kanban, etc.) for each object.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…dlers.ts

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix calendar view to display events instead of list fix: re-attach listViews to object metadata stripped by defineStack() Zod parse Feb 16, 2026
Copilot AI requested a review from hotlong February 16, 2026 01:09
@hotlong hotlong marked this pull request as ready for review February 16, 2026 01:26
Copilot AI review requested due to automatic review settings February 16, 2026 01:26
@hotlong hotlong merged commit d80970e into main Feb 16, 2026
6 checks passed
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

Fixes MSW mock metadata so the console receives listViews for objects (which are stripped by defineStack()’s Zod parse), allowing routes like /apps/crm_app/event/view/calendar to render the calendar view instead of falling back to the default grid.

Changes:

  • Extend the MSW handler factory to accept the original (pre-defineStack) stack config and enrich object metadata responses with listViews.
  • Update MSW browser/server setup to import and pass the named sharedConfig (raw config) into createHandlers.
  • Add a small enrichment helper + lookup (listViewsByObject) so /meta/* endpoints return objects with listViews.

Reviewed changes

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

File Description
apps/console/src/mocks/handlers.ts Adds config-driven enrichment of object metadata (listViews) for meta endpoints.
apps/console/src/mocks/browser.ts Passes sharedConfig into MSW handlers in browser mode so list views are preserved.
apps/console/src/mocks/server.ts Passes sharedConfig into MSW handlers in node/test mode so list views are preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants