Skip to content

Commit 9d17397

Browse files
committed
apply staticProps when soft navigation
1 parent 2365703 commit 9d17397

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hydrate.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export async function hydrate(
3131
const Initial = await import(matched.value);
3232
return hydrateRoot(
3333
document,
34-
<RouterHost Shell={Shell} {...options}>
34+
<RouterHost
35+
Shell={Shell}
36+
staticProps={globalX.__STATIC_PROPS__}
37+
{...options}
38+
>
3539
<Shell
3640
route={globalX.__INITIAL_ROUTE__}
3741
{...globalX.__STATIC_PROPS__}

router/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ export const RouterHost = ({
106106
normalizeUrl = (url: string) => url,
107107
Shell,
108108
onRouteUpdated,
109+
staticProps,
109110
}: {
110111
children: React.ReactElement;
111112
normalizeUrl?: (url: string) => string;
112113
Shell: React.ComponentType<{ children: React.ReactElement; route?: string }>;
113114
onRouteUpdated?: (path: string) => void;
115+
staticProps?: Record<string, unknown>;
114116
}) => {
115117
const pathname = useLocationProperty(
116118
() => normalizeUrl(location.pathname + location.search),
@@ -135,7 +137,7 @@ export const RouterHost = ({
135137
onRouteUpdated?.(target);
136138
setVersion(currentVersion);
137139
setCurrent(
138-
<Shell route={target} {...props}>
140+
<Shell route={target} {...staticProps} {...props}>
139141
<module.default {...props?.props} />
140142
</Shell>
141143
);

0 commit comments

Comments
 (0)