diff --git a/server/src/responders/landing-handler.js b/server/src/responders/landing-handler.js --- a/server/src/responders/landing-handler.js +++ b/server/src/responders/landing-handler.js @@ -9,7 +9,7 @@ import { type LandingSSRProps } from '../landing/landing-ssr.react'; import { waitForStream } from '../utils/json-stream'; -import { getLandingURLFacts, clientURLFromLocalURL } from '../utils/urls'; +import { getLandingURLFacts, clientPathFromRouterPath } from '../utils/urls'; import { getMessageForException } from './utils'; async function landingHandler(req: $Request, res: $Response) { @@ -140,9 +140,9 @@ // We remove trailing slash for `react-router` const routerBasename = basePath.replace(/\/$/, ''); - const publicURL = clientURLFromLocalURL(req.url, urlFacts); + const clientPath = clientPathFromRouterPath(req.url, urlFacts); const reactStream = renderToNodeStream( - , + , ); reactStream.pipe(res, { end: false }); await waitForStream(reactStream); diff --git a/server/src/responders/website-responders.js b/server/src/responders/website-responders.js --- a/server/src/responders/website-responders.js +++ b/server/src/responders/website-responders.js @@ -43,7 +43,7 @@ import { streamJSON, waitForStream } from '../utils/json-stream'; import { getAppURLFactsFromRequestURL, - clientURLFromLocalURL, + clientPathFromRouterPath, } from '../utils/urls'; const { renderToNodeStream } = ReactDOMServer; @@ -301,11 +301,11 @@ const store: Store = createStore(reducer, state); const routerContext = {}; - const clientURL = clientURLFromLocalURL(req.url, appURLFacts); + const clientPath = clientPathFromRouterPath(req.url, appURLFacts); const reactStream = renderToNodeStream( diff --git a/server/src/utils/urls.js b/server/src/utils/urls.js --- a/server/src/utils/urls.js +++ b/server/src/utils/urls.js @@ -30,9 +30,12 @@ return landingURLFacts; } -function clientURLFromLocalURL(url: string, urlFacts: AppURLFacts): string { +function clientPathFromRouterPath( + routerPath: string, + urlFacts: AppURLFacts, +): string { const { basePath } = urlFacts; - return basePath + url; + return basePath + routerPath; } export { @@ -40,5 +43,5 @@ getCommAppURLFacts, getLandingURLFacts, getAppURLFactsFromRequestURL, - clientURLFromLocalURL, + clientPathFromRouterPath, };