October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

What Can Break When You Move Client Projects to the Next.js App Router

Moving routes from the Pages Router to the App Router can expose assumptions about browser APIs, routing hooks, data fetching, shared setup, and caching. Here’s what to audit and how to migrate incrementally.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most common migration breakpoints are code that assumes every component runs in the browser, code that still uses Pages Router routing or data-fetching APIs, and expectations about caching or navigation that differ by Next.js version. The App Router can coexist with the Pages Router, so you can migrate route by route rather than replacing the whole application at once. This guide covers documented framework changes to audit; it does not claim to describe failures from a particular client project.

Choose how much to migrate at once

Next.js allows the app and pages directories to coexist. An incremental migration can limit the scope of each change, but it also means maintaining some setup in both route trees until the Pages Router is no longer needed. An all-at-once migration avoids that overlap sooner, but moves more routes and assumptions together.

As an Amazon Associate I earn from qualifying purchases.

Approach What it means Trade-off to plan for
Incremental Move selected routes to app while routes in pages continue to use the Pages Router. The Next.js migration guide supports coexistence. Contains changes to a smaller part of the application at a time, but shared setup may need attention in both route trees.
All at once Move the application’s routes and conventions to the App Router in one migration. Can remove the period of maintaining two route trees sooner, but makes it harder to isolate which change caused a regression.

For either approach, record the Next.js version and configuration before changing behavior. The migration guide cited here is the version 15 Pages Router guide, last updated April 15, 2025; version-specific upgrade guidance may differ for a newer target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check whether code still assumes it runs in the browser

App Router pages and layouts are Server Components by default. As the Next.js migration guide puts it, “Pages in the app directory are Server Components by default.” A component moved from pages may therefore execute in a different environment than it did before.

Move interactive behavior behind a Client Component boundary

Use a Client Component for interactive state, event handlers, effects, and browser APIs such as window or localStorage. When one of these appears in a component that remains a Server Component, check the component boundary before changing the route’s data-fetching behavior.

Add 'use client' at the boundary that needs client behavior rather than reflexively making an entire route client-rendered. The migration guide describes moving existing page UI into a Client Component as a transitional option: the new server page can fetch data and pass it to that component as props. This preserves a path for reusing UI while keeping server-side work in the page.

Replace Pages Router routing assumptions

Code in the App Router should use routing hooks from next/navigation, not the Pages Router’s next/router. The new useRouter does not expose the old pathname and query fields. Read those concerns separately with usePathname, useSearchParams, and useParams.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Search for old router fields and events

  • Check for router.pathname, router.query, and asPath; identify whether each use needs the pathname, search parameters, or route parameters.
  • Audit uses of locale fields, isReady, and router events rather than assuming the old router object is available in app.
  • If one component must temporarily serve routes in both trees, the migration guide describes next/compat/router as a compatibility option. Treat it as a bridge and verify the component in both route trees.

Translate data fetching, route files, and metadata

Pages Router conventions do not transfer unchanged. In the App Router, data fetching belongs in Server Components and related APIs; getServerSideProps and getStaticProps are not copied over as page functions. The Pages Router’s getStaticPaths maps to generateStaticParams.

Audit the route structure and each data flow

  • Check that route files use App Router conventions such as page, layout, error, and not-found.
  • Where an API route is being migrated, check whether it belongs in an App Router Route Handler.
  • Follow fetched data across the server/client boundary. Confirm what is fetched in the server page and what is passed as props to a Client Component.
  • Replace metadata handled through next/head with the built-in Metadata API.

A page rendering successfully does not by itself confirm that the migrated route has the intended freshness or caching behavior. Check request behavior as well as the rendered result.

Keep shared setup working while both routers exist

The root App Router layout does not automatically replace setup for routes still served from pages. The migration guide recommends keeping _app and _document while Pages Router routes still depend on them. During coexistence, check whether global styles, providers, and scripts are correctly included in both contexts.

React Context providers that need client behavior should live in Client Components. When moving a provider, check which routes consume it in each router; moving it into the App Router layout alone does not cover routes that still render through pages.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose caching and navigation against the exact version

App Router caching behavior is not one unchanging rule. The Next.js 15 upgrade guide documents that Route Handler GET functions are no longer cached by default. It also documents that page segments are not reused in the client router cache during ordinary <Link> or useRouter navigation, while layouts and loading states remain reused.

The Next.js 16 upgrade guide documents further changes, including async request APIs and routing and navigation changes. If Cache Components are enabled, route segment configuration changes as well: the Cache Components migration guidance describes replacing certain configuration with use cache and cacheLife, and requires the Node.js runtime. Do not apply a fix described for a different major version or configuration without checking its applicable upgrade guidance.

Capture the conditions for a stale-data or navigation bug

  • Record the installed Next.js version and relevant configuration.
  • Record whether Cache Components are enabled.
  • Note whether the behavior occurs on a direct load, a client-side transition, or browser back/forward navigation.
  • For stale data or unexpected dynamic rendering, inspect the specific data-fetching and caching path for that version rather than assuming a general App Router default.

A practical migration audit

  1. Inventory routes still served from pages and routes already moved to app; keep the Pages Router setup that those remaining routes depend on.
  2. For each migrated route, identify Server Components and Client Component boundaries. Check browser APIs, effects, event handlers, and interactive state.
  3. Search migrated code for imports from next/router and old router fields. Replace them with the appropriate next/navigation hooks, or use the documented compatibility bridge only where a component is shared across routers.
  4. Translate data fetching, static route generation, route files, API handlers, and metadata to their App Router equivalents.
  5. Check global styles, providers, and scripts in both route trees while they coexist.
  6. Reproduce freshness and navigation issues under the target version and configuration, noting the navigation path used for each case.

The official references for these behaviors are Next.js documentation: “Migrating: App Router” (version 15 Pages Router guide, last updated April 15, 2025), “Server and Client Components” and “Cache Components” (pages carrying March 2026 update dates), and the version 15 and 16 upgrade guides. Use the guide for the project’s actual target release when behavior is version-sensitive.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.