@@ -54,7 +54,6 @@ import { isBot } from '../../shared/lib/router/utils/is-bot'
54
54
import { addBasePath } from '../add-base-path'
55
55
import { AppRouterAnnouncer } from './app-router-announcer'
56
56
import { RedirectBoundary } from './redirect-boundary'
57
- import { NotFoundBoundary } from './not-found-boundary'
58
57
import { findHeadInCache } from './router-reducer/reducers/find-head-in-cache'
59
58
import { createInfinitePromise } from './infinite-promise'
60
59
import { NEXT_RSC_UNION_QUERY } from './app-router-headers'
@@ -89,24 +88,13 @@ export function urlToUrlWithoutFlightMarker(url: string): URL {
89
88
return urlWithoutFlightParameters
90
89
}
91
90
92
- const HotReloader :
93
- | typeof import ( './react-dev-overlay/hot-reloader-client' ) . default
94
- | null =
95
- process . env . NODE_ENV === 'production'
96
- ? null
97
- : ( require ( './react-dev-overlay/hot-reloader-client' )
98
- . default as typeof import ( './react-dev-overlay/hot-reloader-client' ) . default )
99
-
100
91
type AppRouterProps = Omit <
101
92
Omit < InitialRouterStateParameters , 'isServer' | 'location' > ,
102
93
'initialParallelRoutes'
103
94
> & {
104
95
buildId : string
105
96
initialHead : ReactNode
106
97
assetPrefix : string
107
- // Top level boundaries props
108
- notFound : React . ReactNode | undefined
109
- asNotFound ?: boolean
110
98
}
111
99
112
100
function isExternalURL ( url : URL ) {
@@ -224,8 +212,6 @@ function Router({
224
212
initialCanonicalUrl,
225
213
children,
226
214
assetPrefix,
227
- notFound,
228
- asNotFound,
229
215
} : AppRouterProps ) {
230
216
const initialState = useMemo (
231
217
( ) =>
@@ -445,16 +431,26 @@ function Router({
445
431
return findHeadInCache ( cache , tree [ 1 ] )
446
432
} , [ cache , tree ] )
447
433
448
- const notFoundProps = { notFound, asNotFound }
449
-
450
- const content = (
434
+ let content = (
451
435
< RedirectBoundary >
452
436
{ head }
453
437
{ cache . subTreeData }
454
438
< AppRouterAnnouncer tree = { tree } />
455
439
</ RedirectBoundary >
456
440
)
457
441
442
+ if ( process . env . NODE_ENV !== 'production' ) {
443
+ if ( typeof window !== 'undefined' ) {
444
+ const DevRootNotFoundBoundary : typeof import ( './dev-root-not-found-boundary' ) . DevRootNotFoundBoundary =
445
+ require ( './dev-root-not-found-boundary' ) . DevRootNotFoundBoundary
446
+ content = < DevRootNotFoundBoundary > { content } </ DevRootNotFoundBoundary >
447
+ }
448
+ const HotReloader : typeof import ( './react-dev-overlay/hot-reloader-client' ) . default =
449
+ require ( './react-dev-overlay/hot-reloader-client' ) . default
450
+
451
+ content = < HotReloader assetPrefix = { assetPrefix } > { content } </ HotReloader >
452
+ }
453
+
458
454
return (
459
455
< >
460
456
< HistoryUpdater
@@ -484,16 +480,7 @@ function Router({
484
480
url : canonicalUrl ,
485
481
} }
486
482
>
487
- { HotReloader ? (
488
- // HotReloader implements a separate NotFoundBoundary to maintain the HMR ping interval
489
- < HotReloader assetPrefix = { assetPrefix } { ...notFoundProps } >
490
- { content }
491
- </ HotReloader >
492
- ) : (
493
- < NotFoundBoundary { ...notFoundProps } >
494
- { content }
495
- </ NotFoundBoundary >
496
- ) }
483
+ { content }
497
484
</ LayoutRouterContext . Provider >
498
485
</ AppRouterContext . Provider >
499
486
</ GlobalLayoutRouterContext . Provider >
0 commit comments