Skip to content

Commit

Permalink
fix: SSR withoutHTML模式下也需要注入loaderData数据用于注水时
Browse files Browse the repository at this point in the history
  • Loading branch information
奇风 committed Oct 13, 2023
1 parent 8965465 commit 2bc9ad8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/renderer-react/src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ export async function getClientRootComponent(opts: {
</AppContext.Provider>
);
if (opts.withoutHTML) {
return <div id="root">{app}</div>;
return <>
<div id="root">{app}</div>
<script
dangerouslySetInnerHTML={{
__html: `window.__UMI_LOADER_DATA__ = ${JSON.stringify(
opts.loaderData,
)}`,
}}
/>
</>;
}
return (
<Html loaderData={opts.loaderData} manifest={opts.manifest}>
Expand Down

0 comments on commit 2bc9ad8

Please sign in to comment.