next.js
5e098bf2 - Use AppRouterContext instead of publicAppRouterInstance

Commit
81 days ago
Use AppRouterContext instead of publicAppRouterInstance error-boundary.tsx imported publicAppRouterInstance from app-router-instance.ts, which transitively pulls in the entire App Router module graph (router-reducer → fetch-server-response → react-server-dom-webpack/client). This broke any non-App-Router context (e.g. Pages Router) that imports a module depending on error-boundary.tsx, since react-server-dom-webpack/client is unavailable there. Replace with AppRouterContext from the lightweight shared-runtime module, which only contains type imports and React context creation — no heavy runtime dependencies. The error boundary already renders inside the AppRouterContext.Provider scope, so this.context always has the router instance for segment-level boundaries.
Author
Committer
Parents
Loading