File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ const canWrapInSuspense = (
5656 ! route . isRoot ||
5757 ( route . options as RootRouteOptions ) . shellComponent ||
5858 route . options . wrapInSuspense ||
59- ( ssr != null && ssr !== true ) ||
59+ ssr === false ||
60+ ssr === 'data-only' ||
6061 ! ( ( isServer ?? router . isServer ) || router . ssr )
6162
6263export const Match = React . memo ( function MatchImpl ( {
Original file line number Diff line number Diff line change @@ -159,6 +159,31 @@ test('root route hydration without a pending boundary preserves component state'
159159 expect ( consoleError ) . not . toHaveBeenCalled ( )
160160} )
161161
162+ test ( 'an unresolved functional ssr option does not enable a root pending boundary' , async ( ) => {
163+ const rootRoute = createRootRoute ( {
164+ ssr : ( ) => true ,
165+ pendingComponent : ( ) => < div > Root pending</ div > ,
166+ component : ( ) => < div > Root content</ div > ,
167+ } )
168+ const router = createRouter ( {
169+ routeTree : rootRoute ,
170+ history : createMemoryHistory ( { initialEntries : [ '/' ] } ) ,
171+ } )
172+ await router . load ( )
173+
174+ const match = router . stores . matches . get ( ) [ 0 ] !
175+ expect ( typeof match . ssr ) . toBe ( 'function' )
176+
177+ // Client match construction can expose the unresolved route option before
178+ // hydration replaces it with its transported value.
179+ router . ssr = { manifest : { routes : { } } }
180+ router . isServer = true
181+ const html = renderToString ( < RouterProvider router = { router } /> )
182+
183+ expect ( html ) . not . toContain ( '<!--$-->' )
184+ expect ( html ) . toContain ( 'Root content' )
185+ } )
186+
162187test ( 'server rendering uses the root pending boundary inside its document shell' , async ( ) => {
163188 const gate = createControlledPromise < void > ( )
164189 const rootRoute = createRootRoute ( {
You can’t perform that action at this time.
0 commit comments