@rangojs/router 0.0.0-experimental.preview.1774291751 → 0.0.0-experimental.preview.1774295247
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.preview.
|
|
1748
|
+
version: "0.0.0-experimental.preview.1774295247",
|
|
1749
1749
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
1750
1750
|
keywords: [
|
|
1751
1751
|
"react",
|
package/package.json
CHANGED
|
@@ -119,15 +119,14 @@ export function createNavigationClient(
|
|
|
119
119
|
|
|
120
120
|
/** Start a fresh navigation fetch (no cache / inflight hit). */
|
|
121
121
|
const doFreshFetch = (): Promise<Response> => {
|
|
122
|
-
// Dev-only:
|
|
122
|
+
// Dev-only: generate debugId for React Performance Tracks.
|
|
123
|
+
// The debug channel is created AFTER response headers arrive,
|
|
124
|
+
// so the server has time to finish writing debug data before
|
|
125
|
+
// the client sends "ready".
|
|
123
126
|
const debugId = (import.meta as any).hot
|
|
124
127
|
? crypto.randomUUID()
|
|
125
128
|
: undefined;
|
|
126
129
|
debugChannel = null;
|
|
127
|
-
if (debugId) {
|
|
128
|
-
debugChannel = createClientDebugChannel(debugId);
|
|
129
|
-
console.log("[perf-tracks] client: fresh fetch, debugId =", debugId);
|
|
130
|
-
}
|
|
131
130
|
|
|
132
131
|
if (tx) {
|
|
133
132
|
browserDebugLog(tx, "fetching", {
|
|
@@ -148,6 +147,14 @@ export function createNavigationClient(
|
|
|
148
147
|
},
|
|
149
148
|
signal,
|
|
150
149
|
}).then((response) => {
|
|
150
|
+
// Create debug channel now — response headers arrived, meaning
|
|
151
|
+
// the server started streaming. By the time we send "ready",
|
|
152
|
+
// all debug data should be buffered in the relay.
|
|
153
|
+
if (debugId) {
|
|
154
|
+
debugChannel = createClientDebugChannel(debugId);
|
|
155
|
+
console.log("[perf-tracks] client: debug channel created after response for", debugId.slice(0, 8));
|
|
156
|
+
}
|
|
157
|
+
|
|
151
158
|
// Check for version mismatch - server wants us to reload
|
|
152
159
|
const reload = extractRscHeaderUrl(response, "X-RSC-Reload");
|
|
153
160
|
if (reload === "blocked") {
|
|
@@ -141,24 +141,15 @@ export async function initBrowserApp(
|
|
|
141
141
|
initialTheme,
|
|
142
142
|
} = options;
|
|
143
143
|
|
|
144
|
-
// Dev-only: create debug channel for React Performance Tracks.
|
|
145
|
-
// The debugId was injected into the HTML bootstrap by the SSR handler.
|
|
146
|
-
// The client sends a "ready" signal so the server flushes buffered data.
|
|
147
|
-
const ssrDebugId = (globalThis as any).__RANGO_DEBUG_ID__ as
|
|
148
|
-
| string
|
|
149
|
-
| undefined;
|
|
150
|
-
const ssrDebugChannel =
|
|
151
|
-
ssrDebugId && (import.meta as any).hot
|
|
152
|
-
? createClientDebugChannel(ssrDebugId)
|
|
153
|
-
: undefined;
|
|
154
|
-
|
|
155
144
|
// Load initial payload from SSR-injected __FLIGHT_DATA__
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
// Note: debug channel is NOT used for hydration. The WS transport is
|
|
146
|
+
// unreliable during initial page load (JS loads after server finishes
|
|
147
|
+
// rendering, so the "ready" signal arrives too late and chunks are dropped).
|
|
148
|
+
// If createFromReadableStream hangs on a stalled debug stream, the entire
|
|
149
|
+
// app never initializes — blocking all subsequent SPA navigations.
|
|
150
|
+
// Server Component tracks are available for SPA navigations instead.
|
|
151
|
+
const initialPayload =
|
|
152
|
+
await deps.createFromReadableStream<RscPayload>(rscStream);
|
|
162
153
|
|
|
163
154
|
// Extract themeConfig and initialTheme from payload if not explicitly provided
|
|
164
155
|
// This allows virtual entries to work without importing the router
|