diff --git a/packages/cli/src/commands/experimental/templates/streamingSsr/entry.server.tsx.template b/packages/cli/src/commands/experimental/templates/streamingSsr/entry.server.tsx.template index fda9b9b6a01c..a52b268b771d 100644 --- a/packages/cli/src/commands/experimental/templates/streamingSsr/entry.server.tsx.template +++ b/packages/cli/src/commands/experimental/templates/streamingSsr/entry.server.tsx.template @@ -1,20 +1,15 @@ -import { LocationProvider } from '@redwoodjs/router' - import App from './App' import { Document } from './Document' interface Props { - url: string css: string[] meta?: any[] } -export const ServerEntry: React.FC = ({ url, css, meta }) => { +export const ServerEntry: React.FC = ({ css, meta }) => { return ( - - - - - + + + ) } diff --git a/packages/vite/src/streaming/streamHelpers.ts b/packages/vite/src/streaming/streamHelpers.ts index eedd31a34d1f..7085a1189953 100644 --- a/packages/vite/src/streaming/streamHelpers.ts +++ b/packages/vite/src/streaming/streamHelpers.ts @@ -7,6 +7,7 @@ import type { ReactDOMServerReadableStream, } from 'react-dom/server' +import { LocationProvider } from '@redwoodjs/router' import type { TagDescriptor } from '@redwoodjs/web' // @TODO (ESM), use exports field. Cannot import from web because of index exports import { @@ -89,11 +90,19 @@ export async function reactRenderToStreamResponse( { value: injectToPage, }, - ServerEntry({ - url: path, - css: cssLinks, - meta: metaTags, - }) + React.createElement( + LocationProvider, + { + location: { + pathname: path, + }, + }, + ServerEntry({ + url: path, + css: cssLinks, + meta: metaTags, + }) + ) ) }