A remote just redeployed. What should the App Router hydrate?
A customer opens workspace settings on a slow connection. Next.js renders the usage panel from build...
A customer opens workspace settings on a slow connection. Next.js renders the usage panel from build 41. While the browser is loading JavaScript, the usage team promotes build 42. Build 42 changed the first thing the panel renders.
If the browser asks for “the latest panel” at that point, it can get build 42 for HTML that came from build 41. That's a frustrating kind of bug to investigate. The host hasn't changed, most reloads work, and the timing only lines up around a deploy.
Independent deploys are a big reason to keep Module Federation when moving off nextjs-mf. This is one part of how I built next-federation to support them in the App Router.

Resolve the build once per render
A remote component build publishes a descriptor that identifies the build and points to its versioned assets. The App Router host reads that descriptor and passes it to the remote component wrapper. The browser uses the descriptor for this render instead of independently asking which build is current. The host's cache policy determines when fresh renders see a newly promoted build. Host configuration
1. Next.js reads the descriptor for build 41.
2. The host renders the panel and passes that descriptor to its wrapper.
3. The remote promotes build 42.
4. The browser loads build 41 for the HTML it already has.
The build still needs to be available. If the remote deploy wipes the old asset directory, the browser has the right URL but there's nothing at the other end. Publish each build under its own versioned path, promote it after the files are available, and keep previous builds around for cached pages and open tabs. A rollback can move the pointer back to a previous build while leaving both sets of files available. Remote release guide
Decide what can run on the host
Build identity and SSR trust are separate decisions. For production SSR, the host verifies a signed or pinned descriptor and checks each server file against its recorded digest before evaluating it. An unsigned build may render in the browser if the host's policy permits. A failed verification can refuse the build altogether. I'd set a clear panel-level error state and actually open the host with a refused build once in staging. Remote component trust policy
Try a redeploy before you try a migration
The repo includes a local walkthrough that keeps a tab open while an island remote redeploys. It's a quick way to see two build versions coexist. To exercise the Module Federation component path described here, use two signed component builds in staging. Give each a different visible label, promote the second while a page from the first is still loading, and check the build IDs in the browser's network panel. The existing page should finish with the build it received. A fresh render can pick up the new build after the descriptor cache refreshes. Local walkthrough · Component release steps
If your micro-frontends already deploy independently, try this with the smallest widget you ship. I'd love to hear how long your team keeps old build assets and what determines that window. GitHub repository
Sumber artikel open-source oleh Tariq Khan di DEV Community — Baca artikel asli. Topik:
#nextjs#react#webdev#devops
Sukai & bagikan artikel ini
Ditulis & Dikurasi Oleh
Tariq Khan (Open-Source)
Software Engineer yang berfokus pada Next.js, TypeScript, arsitektur backend skalabel, Cloud, dan Applied AI.
Artikel Terkait
Semua artikelJSON-LD in Next.js 16 App Router: SoftwareApplication, FAQPage, and 3 traps I tested
A typed JSON-LD component for the Next.js 16 App Router, tested: the XSS escape, why next/script hides it, and what Google still shows.
My Next.js loading.tsx moved every page's content into a hidden div after the footer
I run eSIMLane, a travel eSIM price comparison site built with Next.js (App Router) and deployed to...
How Do You Build a Browser Calling Desk for a 10-SIM GSM Gateway with Asterisk and Next.js?
Asterisk owns the calls, a Next.js portal owns the desk: number rules, SIM hunt, a live channel board and AMI, read from the Agent Line code and tests.
The booking was saved, but the customer saw an error: email after commit in Next.js
This bug made it into the released versions of my Next.js 15 templates (two booking sites, a...

Komentar