@rangojs/router 0.0.0-experimental.a5f27bd5 → 0.0.0-experimental.f788c642
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/AGENTS.md +4 -0
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/src/browser/navigation-bridge.ts +8 -9
package/AGENTS.md
CHANGED
|
@@ -3,3 +3,7 @@
|
|
|
3
3
|
A file-system based React Server Components router.
|
|
4
4
|
|
|
5
5
|
Run `/rango` to understand the API. Detailed guides for each feature are in the `skills/` directory (e.g. `node_modules/@rangojs/router/skills/loader`, `skills/caching`, `skills/middleware`, etc.).
|
|
6
|
+
|
|
7
|
+
## Development rules
|
|
8
|
+
|
|
9
|
+
- Always commit generated files (e.g. `*.gen.ts`) alongside the source changes that produced them.
|
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.f788c642",
|
|
1749
1749
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
1750
1750
|
keywords: [
|
|
1751
1751
|
"react",
|
package/package.json
CHANGED
|
@@ -40,11 +40,6 @@ if (typeof Symbol.dispose === "undefined") {
|
|
|
40
40
|
(Symbol as any).dispose = Symbol("Symbol.dispose");
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** Get IDs of non-loader segments (layouts, routes, parallels). */
|
|
44
|
-
function getNonLoaderSegmentIds(segments: ResolvedSegment[]): string[] {
|
|
45
|
-
return segments.filter((s) => s.type !== "loader").map((s) => s.id);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
43
|
export { createNavigationTransaction };
|
|
49
44
|
|
|
50
45
|
/**
|
|
@@ -284,7 +279,7 @@ export function createNavigationBridge(
|
|
|
284
279
|
await fetchPartialUpdate(
|
|
285
280
|
url,
|
|
286
281
|
hasUsableCache
|
|
287
|
-
?
|
|
282
|
+
? cachedSegments!.map((s) => s.id)
|
|
288
283
|
: options?._skipCache
|
|
289
284
|
? [] // Action redirect: send no segments so server renders everything fresh
|
|
290
285
|
: undefined,
|
|
@@ -490,14 +485,18 @@ export function createNavigationBridge(
|
|
|
490
485
|
onUpdate(popstateUpdate);
|
|
491
486
|
}
|
|
492
487
|
|
|
493
|
-
// Restore scroll position for back/forward navigation
|
|
494
|
-
|
|
488
|
+
// Restore scroll position for back/forward navigation.
|
|
489
|
+
// Defer to rAF so React has committed the cached content to the DOM
|
|
490
|
+
// before we measure scrollHeight and restore the scroll position.
|
|
491
|
+
requestAnimationFrame(() => {
|
|
492
|
+
handleNavigationEnd({ restore: true, isStreaming });
|
|
493
|
+
});
|
|
495
494
|
|
|
496
495
|
// SWR: If stale, trigger background revalidation
|
|
497
496
|
if (isStale) {
|
|
498
497
|
debugLog("[Browser] Cache is stale, background revalidating...");
|
|
499
498
|
// Background revalidation - don't await, just fire and forget
|
|
500
|
-
const segmentIds =
|
|
499
|
+
const segmentIds = cachedSegments.map((s) => s.id);
|
|
501
500
|
|
|
502
501
|
const tx = createNavigationTransaction(
|
|
503
502
|
store,
|