Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3392966
D3580.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3580.diff
View Options
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(
- <LandingSSR url={publicURL} basename={routerBasename} />,
+ <LandingSSR url={clientPath} basename={routerBasename} />,
);
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<AppState, Action> = createStore(reducer, state);
const routerContext = {};
- const clientURL = clientURLFromLocalURL(req.url, appURLFacts);
+ const clientPath = clientPathFromRouterPath(req.url, appURLFacts);
const reactStream = renderToNodeStream(
<Provider store={store}>
<StaticRouter
- location={clientURL}
+ location={clientPath}
basename={baseURL}
context={routerContext}
>
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,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 10:48 AM (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604797
Default Alt Text
D3580.diff (2 KB)
Attached To
Mode
D3580: [server] Rename clientURLFromLocalURL to clientPathFromRouterPath
Attached
Detach File
Event Timeline
Log In to Comment