Skip to content

Fix console 404s and navigation validation errors#412

Merged
hotlong merged 2 commits intomainfrom
copilot/fix-console-error-deprecation
Feb 9, 2026
Merged

Fix console 404s and navigation validation errors#412
hotlong merged 2 commits intomainfrom
copilot/fix-console-error-deprecation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 9, 2026

Console browser mode fails because MSW handlers only intercept /api/v1/... but ObjectStackClient requests /api/.... Additionally, type: 'report' navigation items fail @objectstack/objectql Zod validation.

  • MSW handler path mismatch (browser.ts): Added legacy /api handlers alongside /api/v1, matching the pattern server.ts already uses for tests:

    const v1Handlers = createHandlers('/api/v1', kernel, driver);
    const legacyHandlers = createHandlers('/api', kernel, driver);
    const handlers = [...v1Handlers, ...legacyHandlers];
  • Navigation schema validation (objectstack.shared.ts): Changed injected report nav item from unsupported type: 'report' to type: 'url' with explicit path. AppSidebar renders url items via React Router <Link>, so behavior is preserved.


💡 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
Copy Markdown

vercel Bot commented Feb 9, 2026

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

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 9, 2026 10:59am
objectui-console Ready Ready Preview, Comment Feb 9, 2026 10:59am
objectui-storybook Ready Ready Preview, Comment Feb 9, 2026 10:59am

Request Review

…rt navigation validation

1. browser.ts: Add legacy /api handlers alongside /api/v1 handlers so
   ObjectStackClient requests to /api/meta/... and /api/data/... are
   intercepted by MSW (fixes 404 errors). This matches the pattern
   already used in server.ts for tests.

2. objectstack.shared.ts: Change report navigation item from
   type:'report' (unsupported by @objectstack/objectql schema) to
   type:'url' with explicit path, eliminating Zod validation warnings
   while preserving the same navigation behavior.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix console error related to component registration Fix console 404s and navigation validation errors Feb 9, 2026
Copilot AI requested a review from hotlong February 9, 2026 10:57
@hotlong hotlong marked this pull request as ready for review February 9, 2026 11:20
Copilot AI review requested due to automatic review settings February 9, 2026 11:20
@hotlong hotlong merged commit 8b54dfb into main Feb 9, 2026
5 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 console “browser mode” breakage by ensuring MSW intercepts the base paths probed by ObjectStackClient, and resolves navigation Zod validation failures by using a supported navigation item type.

Changes:

  • Add MSW handlers for both /api/v1 and legacy /api in the browser worker setup to prevent 404s.
  • Change the injected CRM “report” navigation entry from unsupported type: 'report' to supported type: 'url' pointing at the report route.

Reviewed changes

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

File Description
apps/console/src/mocks/browser.ts Adds dual handler sets so MSW intercepts both /api/v1 and /api requests in browser mode.
apps/console/objectstack.shared.ts Updates injected CRM navigation item to a supported url type to satisfy schema validation while preserving routing.

Comment on lines +55 to +59
// Include both /api/v1 and legacy /api paths so the ObjectStackClient can
// reach the mock server regardless of which base URL it probes.
const v1Handlers = createHandlers('/api/v1', kernel, driver);
const legacyHandlers = createHandlers('/api', kernel, driver);
const handlers = [...v1Handlers, ...legacyHandlers];
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Calling createHandlers() twice duplicates the wildcard */.well-known/objectstack handler (and any other baseUrl-independent handlers inside createHandlers). It works, but it adds unnecessary duplication and makes future handler edits more error-prone due to ordering. Consider defining .well-known once outside createHandlers, or add an option to omit baseUrl-independent routes for the second call.

Copilot uses AI. Check for mistakes.
Comment on lines 20 to 23
id: 'nav_sales_report',
type: 'report',
reportName: 'sales_performance_q1',
type: 'url',
url: '/apps/crm_app/report/sales_performance_q1',
label: 'Sales Report',
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The injected report link hardcodes the app name (/apps/crm_app/...) even though crmApp.name is available. Using the actual app name from the config avoids drift if the CRM example app name ever changes or if this patch is reused for a different app.

Copilot uses AI. Check for mistakes.
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