diff --git a/packages/tanstack/src/hooks/CdnSegmentMarker.tsx b/packages/tanstack/src/hooks/CdnSegmentMarker.tsx new file mode 100644 index 00000000..35ebea31 --- /dev/null +++ b/packages/tanstack/src/hooks/CdnSegmentMarker.tsx @@ -0,0 +1,35 @@ +/** + * Publishes the CDN segment token this server computed, so `decoServerFnFetch` + * can echo it back on `/_serverFn` URLs. + * + * Only the server can produce this value: the segment includes dimensions the + * browser cannot observe — region is resolved from `request.cf.regionCode`. + * A client that derives its own token therefore never matches on a + * regionalized store, which is exactly why this component exists. + * + * - **Server:** read the token from the RequestContext bag (filled by + * `createDecoWorkerEntry`) and emit a tiny inline `