Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 3, 2025

Upgrade to Next.js 16.0.0 and React 19.2.0 + Merge from app

This PR upgrades Next.js from 15.5.4 to 16.0.0 and React from 19.0.0 to 19.2.0, following the official Next.js 16 upgrade guide and using PR #4453 as reference. Additionally, this PR merges the latest 10 commits from the app branch, including LLM authentication endpoints, editor improvements, and caching optimizations.

What was the motivation & context behind this PR?

User requested a minimal-change upgrade to Next.js 16. Per feedback from a Vercel engineer: "anything that you want to render statically, mark with "use cache"". After consultation, I took a minimal-risk approach:

  • Keep cacheComponents disabled for fern-docs/bundle (avoiding prerender errors)
  • Add "use cache" directive to pages that previously used export const dynamic = "force-static" as forward-compatible annotation
  • Remove incompatible route segment config exports
  • Merge latest changes from app branch to stay current

Key changes made:

Breaking changes handled:

  • Renamed middleware.tsproxy.ts in fern-docs/bundle (Next.js 16 requirement)
  • Updated next-env.d.ts files to use import instead of /// <reference path>
  • Moved experimental.turbo config to top-level turbopack config

Route segment config:

  • Removed ~20+ export const dynamic and export const revalidate declarations (incompatible with Next.js 16 when using cacheComponents)
  • Added "use cache" directive to static pages as forward-compatible annotation
  • Added unstable_noStore() calls to API routes needing dynamic rendering

Rendering changes:

  • Created ScrollToTopClient wrapper with Suspense boundary (avoids uncached data access errors during prerendering)
  • Kept cacheComponents disabled in fern-docs/bundle next.config.ts (minimal-risk approach)
  • Enabled cacheComponents in fern-dashboard next.config.ts

Build configuration:

  • Added --webpack flag to build scripts (continue using webpack instead of Turbopack)
  • Updated rspack to use @next/rspack-core instead of @rspack/core
  • Updated webpack externals to externalize esbuild, sharp, and mongodb subdependencies
  • Removed ForceCompleteRuntimePlugin from rspack builds

App branch merge (10 commits):

How has this PR been tested?

✅ All CI checks passed (15/15 green)
✅ All Vercel deployments succeeded
✅ Local build tested: QSTASH_TOKEN=stub pnpm -F @fern-docs/bundle exec next build --webpack
✅ Lint and format checks passed
✅ Merge from app branch completed cleanly with no conflicts

Preview deployments:

Human review checklist:

⚠️ High priority:

  • Verify "use cache" directive placement is correct (should be FIRST statement in file, before any imports)
  • Test that pages that previously had export const dynamic = "force-static" still render statically
  • Test dynamic routes still work without explicit route segment config exports
  • Confirm middleware → proxy rename didn't break routing or authentication flows
  • Test scroll-to-top behavior with new ScrollToTopClient wrapper
  • Spot-check preview deployments for runtime caching issues (Next.js 16 changed caching behavior significantly)

Medium priority:

  • Verify API routes with unstable_noStore() still render dynamically
  • Check that rspack development builds work correctly with @next/rspack-core
  • Confirm build performance is acceptable with webpack (not Turbopack)
  • Verify that the app branch merge didn't introduce regressions (especially the new LLM auth endpoint and editor changes)

Requested by: Deep Singhvi (@dsinghvi)
Devin session: https://app.devin.ai/sessions/d394041c655645aa9ad3a63a1b30a7ff

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Contributor

vercel bot commented Nov 3, 2025

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

Project Deployment Preview Updated (UTC)
dev.ferndocs.com Ready Ready Preview Nov 4, 2025 5:22pm
fern-dashboard Ready Ready Preview Nov 4, 2025 5:22pm
fern-dashboard-dev Ready Ready Preview Nov 4, 2025 5:22pm
ferndocs.com Ready Ready Preview Nov 4, 2025 5:22pm
preview.ferndocs.com Ready Ready Preview Nov 4, 2025 5:22pm
prod-assets.ferndocs.com Ready Ready Preview Nov 4, 2025 5:22pm
prod.ferndocs.com Ready Ready Preview Nov 4, 2025 5:22pm
1 Skipped Deployment
Project Deployment Preview Updated (UTC)
fern-platform Ignored Ignored Nov 4, 2025 5:22pm

- Rename icons-cdn middleware.ts to proxy.ts
- Add experimental.cacheComponents: true to both next.config.ts files
- This enables cacheTag() functionality required in Next.js 16

Co-Authored-By: Deep Singhvi <[email protected]>
…ings

- Add --webpack to all next build commands in package.json files
  - fern-docs/bundle: docs:build:local, docs:build:selfhosted, docs:build:selfserved
  - fern-docs/icons-cdn: build
  - fern-docs/search-ui: demo:build
  - fern-dashboard: dashboard:rsd
- Fix deprecation: skipMiddlewareUrlNormalize → skipProxyUrlNormalize
- Fix deprecation: move cacheComponents from experimental to top-level
- This ensures all Vercel deployments use webpack instead of defaulting to Turbopack

Co-Authored-By: Deep Singhvi <[email protected]>
…nents

- Remove 'export const revalidate' from 9 files in fern-docs/bundle
- Remove 'export const revalidate' from 2 files in fern-dashboard
- These exports are incompatible with cacheComponents: true in Next.js 16
- Fixes webpack build errors: 'Route segment config revalidate is not compatible with nextConfig.cacheComponents'

Co-Authored-By: Deep Singhvi <[email protected]>
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.

1 participant