@rangojs/router 0.0.0-experimental.44 → 0.0.0-experimental.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vite/index.js
CHANGED
|
@@ -1745,7 +1745,7 @@ import { resolve } from "node:path";
|
|
|
1745
1745
|
// package.json
|
|
1746
1746
|
var package_default = {
|
|
1747
1747
|
name: "@rangojs/router",
|
|
1748
|
-
version: "0.0.0-experimental.
|
|
1748
|
+
version: "0.0.0-experimental.45",
|
|
1749
1749
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
1750
1750
|
keywords: [
|
|
1751
1751
|
"react",
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import type { MiddlewareFn, MiddlewareContext } from "../router/middleware.js";
|
|
15
15
|
import { getRequestContext } from "../server/request-context.js";
|
|
16
|
+
import { mayNeedSSR } from "../rsc/ssr-setup.js";
|
|
16
17
|
import { sortedSearchString } from "./cache-key-utils.js";
|
|
17
18
|
import { runBackground } from "./background-task.js";
|
|
18
19
|
|
|
@@ -241,9 +242,12 @@ export function createDocumentCacheMiddleware<TEnv = any>(
|
|
|
241
242
|
return next();
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
// Determine request type for cache key differentiation
|
|
245
|
+
// Determine request type for cache key differentiation.
|
|
246
|
+
// Full-document RSC fetches (Accept: text/x-component or __rsc) must not
|
|
247
|
+
// share the HTML cache slot for the same pathname.
|
|
245
248
|
const isPartial = url.searchParams.has("_rsc_partial");
|
|
246
|
-
const
|
|
249
|
+
const isRscRequest = !mayNeedSSR(ctx.request, url);
|
|
250
|
+
const typeLabel = isRscRequest ? "RSC" : "HTML";
|
|
247
251
|
|
|
248
252
|
// Track whether next() has been called so the catch block knows
|
|
249
253
|
// whether it is safe to fall through to the handler.
|
|
@@ -257,7 +261,7 @@ export function createDocumentCacheMiddleware<TEnv = any>(
|
|
|
257
261
|
const clientSegments = url.searchParams.get("_rsc_segments") || "";
|
|
258
262
|
const segmentHash =
|
|
259
263
|
isPartial && clientSegments ? `:${hashSegmentIds(clientSegments)}` : "";
|
|
260
|
-
const typeSuffix =
|
|
264
|
+
const typeSuffix = isRscRequest ? ":rsc" : ":html";
|
|
261
265
|
|
|
262
266
|
let searchSuffix = "";
|
|
263
267
|
if (!keyGenerator) {
|