Skip to content

Commit 5c52018

Browse files
committed
refactor
1 parent 7c185d9 commit 5c52018

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/react-router-dev/vite/rsc/virtual-route-modules.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async function createVirtualRouteModuleCode({
100100
}
101101
}
102102
if (viteCommand === "serve" && !hasClientExports) {
103-
code += `export { __ensureClientRouteModuleForHmr } from "${clientModuleId}";\n`;
103+
code += `export { __ensureClientRouteModuleForHMR } from "${clientModuleId}";\n`;
104104
}
105105
} else {
106106
for (const staticExport of staticExports) {
@@ -183,7 +183,7 @@ function createVirtualClientRouteModuleCode({
183183
}
184184

185185
if (viteCommand === "serve" && isServerFirstRoute && !hasClientExports) {
186-
generatorResult.code += `\nexport const __ensureClientRouteModuleForHmr = true;`;
186+
generatorResult.code += `\nexport const __ensureClientRouteModuleForHMR = true;`;
187187
}
188188

189189
return generatorResult;
@@ -198,9 +198,9 @@ export function parseRouteExports(code: string) {
198198
return {
199199
staticExports,
200200
isServerFirstRoute,
201-
hasClientExports: isServerFirstRoute
202-
? staticExports.some(isClientNonComponentExport)
203-
: staticExports.some(isClientRouteExport),
201+
hasClientExports: staticExports.some(
202+
isServerFirstRoute ? isClientNonComponentExport : isClientRouteExport,
203+
),
204204
};
205205
}
206206

packages/react-router-dev/vite/static/rsc-refresh-utils.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function validateRefreshBoundaryAndEnqueueUpdate(
7878
nextExports,
7979
(key, value) => {
8080
hasExports = true;
81-
// Remix can handle Remix-specific exports (e.g. `meta` and `links`)
81+
// React Router can handle additional exports (e.g. `meta` and `links`)
8282
if (acceptExports.includes(key)) return true;
8383
// React Fast Refresh can handle component exports
8484
if (exports.isLikelyComponentType(value)) return true;

packages/react-router/lib/rsc/server.rsc.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,11 @@ async function getRSCRouteMatch(
11111111
pathnameBase: match.pathnameBase,
11121112
shouldRevalidate: (match.route as any).shouldRevalidate,
11131113
// Add an unused client-only export (if present) so HMR can support
1114-
// switching from server-first to client-only routes during development
1115-
...((match.route as any).__ensureClientRouteModuleForHmr
1114+
// switching between server-first and client-only routes during development
1115+
...((match.route as any).__ensureClientRouteModuleForHMR
11161116
? {
1117-
__ensureClientRouteModuleForHmr: (match.route as any)
1118-
.__ensureClientRouteModuleForHmr,
1117+
__ensureClientRouteModuleForHMR: (match.route as any)
1118+
.__ensureClientRouteModuleForHMR,
11191119
}
11201120
: {}),
11211121
};

0 commit comments

Comments
 (0)