Skip to content

Fix MDX component type incompatibility with React 19#524

Merged
hotlong merged 2 commits into
mainfrom
copilot/add-logging-functionality-again
Feb 5, 2026
Merged

Fix MDX component type incompatibility with React 19#524
hotlong merged 2 commits into
mainfrom
copilot/add-logging-functionality-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 5, 2026

Vercel builds failing with TypeScript error in mdx-components.tsx. React 19's FC type returns ReactNode | Promise<ReactNode> for Server Component support, but @types/mdx expects ReactNode.

Changes

  • Added type assertion as MDXComponents to useMDXComponents return value
export function useMDXComponents(components: MDXComponents): MDXComponents {
  return {
    ...defaultComponents,
    ...components,
  } as MDXComponents;
}

Type assertion is safe—fumadocs components are MDX-compatible at runtime, structural typing ensures shape correctness.

Original prompt

18:00:53.617 Running build in Washington, D.C., USA (East) – iad1
18:00:53.617 Build machine configuration: 4 cores, 8 GB
18:00:53.721 Cloning github.com/objectstack-ai/spec (Branch: copilot/add-logging-functionality, Commit: 7c81d37)
18:00:54.565 Cloning completed: 844.000ms
18:00:55.832 Restored build cache from previous deployment (GAnvNjuAfCLLyPPuEpAEGDyGdJeK)
18:00:56.164 Warning: Detected "engines": { "node": ">=18.0.0" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
18:00:56.164 Running "vercel build"
18:00:57.834 Vercel CLI 50.10.2
18:00:58.112 Warning: Detected "engines": { "node": ">=18.0.0" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
18:00:58.171 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.1
18:00:58.208 Installing dependencies...
18:01:00.432 Scope: all 26 workspace projects
18:01:00.709 ../.. | -2 -
18:01:01.886
18:01:01.977 ╭ Warning ─────────────────────────────────────────────────────────────────────╮
18:01:01.977 │ │
18:01:01.977 │ Ignored build scripts: @nestjs/core@10.4.22. │
18:01:01.977 │ Run "pnpm approve-builds" to pick which dependencies should be allowed │
18:01:01.977 │ to run scripts. │
18:01:01.978 │ │
18:01:01.978 ╰──────────────────────────────────────────────────────────────────────────────╯
18:01:01.983 Done in 1.9s using pnpm v10.28.1
18:01:02.009 Detected Next.js version: 16.1.6
18:01:02.036 Running "pnpm run build"
18:01:02.632
18:01:02.632 > @objectstack/docs@1.0.4 build /vercel/path0/apps/docs
18:01:02.632 > pnpm --filter @objectstack/spec gen:docs && next build
18:01:02.633
18:01:02.980
18:01:02.980 > @objectstack/spec@1.0.4 gen:docs /vercel/path0/packages/spec
18:01:02.980 > tsx scripts/build-docs.ts
18:01:02.980
18:01:03.393 Building documentation...
18:01:03.410 ✓ Generated ai/plugin-development.mdx
18:01:03.411 ✓ Generated ai/agent.mdx
18:01:03.411 ✓ Generated ai/cost.mdx
18:01:03.412 ✓ Generated ai/runtime-ops.mdx
18:01:03.412 ✓ Generated ai/orchestration.mdx
18:01:03.413 ✓ Generated ai/agent-action.mdx
18:01:03.414 ✓ Generated ai/devops-agent.mdx
18:01:03.415 ✓ Generated ai/rag-pipeline.mdx
18:01:03.415 ✓ Generated ai/conversation.mdx
18:01:03.416 ✓ Generated ai/nlq.mdx
18:01:03.416 ✓ Generated ai/predictive.mdx
18:01:03.416 ✓ Generated ai/feedback-loop.mdx
18:01:03.418 ✓ Generated ai/model-registry.mdx
18:01:03.429 ✓ Generated api/websocket.mdx
18:01:03.430 ✓ Generated api/analytics.mdx
18:01:03.430 ✓ Generated api/discovery.mdx
18:01:03.430 ✓ Generated api/documentation.mdx
18:01:03.431 ✓ Generated api/registry.mdx
18:01:03.431 ✓ Generated api/endpoint.mdx
18:01:03.431 ✓ Generated api/contract.mdx
18:01:03.432 ✓ Generated api/metadata.mdx
18:01:03.432 ✓ Generated api/auth.mdx
18:01:03.432 ✓ Generated api/protocol.mdx
18:01:03.434 ✓ Generated api/batch.mdx
18:01:03.434 ✓ Generated api/rest-server.mdx
18:01:03.435 ✓ Generated api/hub.mdx
18:01:03.435 ✓ Generated api/http-cache.mdx
18:01:03.435 ✓ Generated api/storage.mdx
18:01:03.436 ✓ Generated api/errors.mdx
18:01:03.436 ✓ Generated api/graphql.mdx
18:01:03.436 ✓ Generated api/view.mdx
18:01:03.437 ✓ Generated api/odata.mdx
18:01:03.437 ✓ Generated api/realtime.mdx
18:01:03.437 ✓ Generated api/connector.mdx
18:01:03.437 ✓ Generated api/router.mdx
18:01:03.437 ✓ Generated api/identity.mdx
18:01:03.440 ✓ Generated automation/approval.mdx
18:01:03.440 ✓ Generated automation/trigger-registry.mdx
18:01:03.441 ✓ Generated automation/connector.mdx
18:01:03.441 ✓ Generated automation/workflow.mdx
18:01:03.441 ✓ Generated automation/sync.mdx
18:01:03.442 ✓ Generated automation/etl.mdx
18:01:03.442 ✓ Generated automation/flow.mdx
18:01:03.442 ✓ Generated automation/webhook.mdx
18:01:03.443 Warning: Schema directory /vercel/path0/packages/spec/json-schema/contracts does not exist
18:01:03.450 ✓ Generated data/field.mdx
18:01:03.451 ✓ Generated data/query.mdx
18:01:03.451 ✓ Generated data/driver-nosql.mdx
18:01:03.451 ✓ Generated data/analytics.mdx
18:01:03.452 ✓ Generated data/object.mdx
18:01:03.452 ✓ Generated data/validation.mdx
18:01:03.452 ✓ Generated data/filter.mdx
18:01:03.453 ✓ Generated data/data-engine.mdx
18:01:03.453 ✓ Generated data/driver-sql.mdx
18:01:03.453 ✓ Generated data/dataset.mdx
18:01:03.457 ✓ Generated data/datasource.mdx
18:01:03.457 ✓ Generated data/document.mdx
18:01:03.457 ✓ Generated data/driver.mdx
18:01:03.457 ✓ Generated data/external-lookup.mdx
18:01:03.457 ✓ Generated data/mapping.mdx
18:01:03.457 ✓ Generated data/hook.mdx
18:01:03.457 ✓ ...


✨ 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 Feb 5, 2026

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Feb 5, 2026 10:15am

Request Review

…ibility

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logging functionality to the application Fix MDX component type incompatibility with React 19 Feb 5, 2026
Copilot AI requested a review from hotlong February 5, 2026 10:13
@github-actions github-actions Bot added documentation Improvements or additions to documentation size/xs labels Feb 5, 2026
@hotlong hotlong marked this pull request as ready for review February 5, 2026 10:38
Copilot AI review requested due to automatic review settings February 5, 2026 10:38
@hotlong hotlong merged commit 9c04648 into main Feb 5, 2026
15 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

This PR fixes a TypeScript compilation error that was causing Vercel builds to fail due to React 19's updated type definitions. React 19's FC type now returns ReactNode | Promise<ReactNode> to support Server Components, which conflicts with @types/mdx@2.0.13's expectation of just ReactNode. Additionally, it cleans up an empty documentation stub for the contracts module.

Changes:

  • Added type assertion as MDXComponents to resolve React 19 type incompatibility in MDX component configuration
  • Removed empty meta.json file for contracts documentation (contracts module contains TypeScript interfaces, not Zod schemas requiring documentation)

Reviewed changes

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

File Description
apps/docs/mdx-components.tsx Added type assertion to fix React 19 FC type incompatibility with @types/mdx
content/docs/references/contracts/meta.json Removed empty meta.json file since contracts module has no generated documentation
Comments suppressed due to low confidence (1)

content/docs/references/contracts/meta.json:1

  • While deleting this empty meta.json file is correct since no documentation exists for the contracts module (it contains TypeScript interfaces, not Zod schemas), the parent content/docs/references/meta.json file still references "contracts" in its pages array. This will likely cause a broken navigation link since the contracts directory doesn't exist. Consider removing "contracts" from the parent meta.json's pages array in a follow-up commit or updating this PR to include that change.

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 size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants