Skip to content

Commit 254076c

Browse files
committed
add route parameter to shell
1 parent bbcb205 commit 254076c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

hydrate.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export async function hydrate(
2828
return hydrateRoot(
2929
document,
3030
<RouterHost Shell={Shell} {...options}>
31-
<Shell {...globalX.__SERVERSIDE_PROPS__}>
31+
<Shell
32+
route={globalX.__INITIAL_ROUTE__}
33+
{...globalX.__SERVERSIDE_PROPS__}
34+
>
3235
<Initial.default {...globalX.__SERVERSIDE_PROPS__?.props} />
3336
</Shell>
3437
</RouterHost>,

index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class StaticRouters {
8989
});
9090
}
9191
const stream = await renderToReadableStream(
92-
<Shell {...result}>
92+
<Shell route={serverSide.pathname + search} {...result}>
9393
<module.default {...result?.props} />
9494
</Shell>,
9595
{

router/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const RouterHost = ({
6969
onRouteUpdated,
7070
}: {
7171
children: React.ReactElement;
72-
Shell: React.ComponentType<{ children: React.ReactElement }>;
72+
Shell: React.ComponentType<{ children: React.ReactElement; route?: string }>;
7373
onRouteUpdated?: (path: string) => void;
7474
}) => {
7575
const pathname = useLocationProperty(
@@ -95,7 +95,7 @@ export const RouterHost = ({
9595
onRouteUpdated?.(target);
9696
setVersion(currentVersion);
9797
setCurrent(
98-
<Shell {...props}>
98+
<Shell route={target} {...props}>
9999
<module.default {...props?.props} />
100100
</Shell>
101101
);

0 commit comments

Comments
 (0)