@@ -40,6 +40,7 @@ import type { RouteMatch, RouteObject } from "../context";
40
40
import invariant from "../server-runtime/invariant" ;
41
41
42
42
import {
43
+ Outlet as UNTYPED_Outlet ,
43
44
UNSAFE_WithComponentProps ,
44
45
UNSAFE_WithHydrateFallbackProps ,
45
46
UNSAFE_WithErrorBoundaryProps ,
@@ -48,13 +49,15 @@ import {
48
49
// TSConfig, it breaks the Parcel build within this repo.
49
50
} from "react-router/internal/react-server-client" ;
50
51
import type {
52
+ Outlet as OutletType ,
51
53
WithComponentProps as WithComponentPropsType ,
52
54
WithErrorBoundaryProps as WithErrorBoundaryPropsType ,
53
55
WithHydrateFallbackProps as WithHydrateFallbackPropsType ,
54
56
RouteComponentProps ,
55
57
ErrorBoundaryProps ,
56
58
HydrateFallbackProps ,
57
59
} from "../components" ;
60
+ const Outlet : typeof OutletType = UNTYPED_Outlet ;
58
61
const WithComponentProps : typeof WithComponentPropsType =
59
62
UNSAFE_WithComponentProps ;
60
63
const WithErrorBoundaryProps : typeof WithErrorBoundaryPropsType =
@@ -1016,8 +1019,9 @@ async function getRSCRouteMatch(
1016
1019
const actionData = staticContext . actionData ?. [ match . route . id ] ;
1017
1020
const params = match . params ;
1018
1021
// TODO: DRY this up once it's fully fleshed out
1019
- const element =
1020
- Component && shouldRenderComponent
1022
+ let element : React . ReactElement | undefined = undefined ;
1023
+ if ( Component ) {
1024
+ element = shouldRenderComponent
1021
1025
? React . createElement (
1022
1026
Layout ,
1023
1027
null ,
@@ -1034,8 +1038,8 @@ async function getRSCRouteMatch(
1034
1038
) ,
1035
1039
} satisfies RouteComponentProps ) ,
1036
1040
)
1037
- : // TODO: Render outlet instead?
1038
- undefined ;
1041
+ : React . createElement ( Outlet ) ;
1042
+ }
1039
1043
let error : unknown = undefined ;
1040
1044
1041
1045
if ( ErrorBoundary && staticContext . errors ) {
0 commit comments