@rangojs/router 0.36.1 → 0.37.0
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/bin/{chunk-THW7E5A2.js → chunk-A64EG6MI.js} +22 -19
- package/dist/bin/{client-urls-projection-DHUUOJZM.js → client-urls-projection-RLDSA3BL.js} +1 -1
- package/dist/bin/rango.js +1 -1
- package/dist/bin/{runtime-discovery-OPRGB3DF.js → runtime-discovery-T7ZLA6E3.js} +2 -2
- package/dist/bin/{temp-rsc-server-FV4ERMAS.js → temp-rsc-server-FGGXPKVQ.js} +2 -2
- package/dist/types/browser/event-controller.d.ts +53 -2
- package/dist/types/browser/fetched-loader-handles.d.ts +57 -14
- package/dist/types/browser/navigation-store.d.ts +3 -2
- package/dist/types/browser/react/use-handle.d.ts +18 -5
- package/dist/types/browser/react/use-push-handle.d.ts +44 -0
- package/dist/types/browser/types.d.ts +44 -0
- package/dist/types/client.d.ts +1 -0
- package/dist/types/client.rsc.d.ts +1 -0
- package/dist/types/handle.d.ts +13 -5
- package/dist/types/handles/client-pushes.d.ts +51 -0
- package/dist/types/handles/deferred-resolution.d.ts +7 -0
- package/dist/types/handles/pushed-by.d.ts +11 -0
- package/dist/types/loader-store.d.ts +13 -0
- package/dist/types/rsc/prefetch-render-error.d.ts +2 -1
- package/dist/types/server/handle-store.d.ts +8 -0
- package/dist/types/testing/dom.entry.d.ts +1 -1
- package/dist/types/testing/render-route.d.ts +74 -14
- package/dist/vite/index.js +23 -20
- package/package.json +1 -1
- package/skills/breadcrumbs/SKILL.md +68 -6
- package/skills/caching/SKILL.md +4 -2
- package/skills/catalog.json +3 -3
- package/skills/client-urls/SKILL.md +13 -1
- package/skills/document-cache/SKILL.md +31 -1
- package/skills/hooks/SKILL.md +8 -4
- package/skills/hooks/data.md +10 -1
- package/skills/hooks/handle-and-actions.md +402 -26
- package/skills/hooks/navigation.md +4 -0
- package/skills/hooks/urls.md +3 -0
- package/skills/links/SKILL.md +5 -3
- package/skills/loader/SKILL.md +28 -9
- package/skills/migrate-nextjs/SKILL.md +5 -0
- package/skills/migrate-react-router/component-migration.md +4 -1
- package/skills/parallel/SKILL.md +8 -0
- package/skills/ppr/SKILL.md +1 -0
- package/skills/rango/SKILL.md +6 -3
- package/skills/testing/client-components.md +35 -32
- package/skills/testing/handles.md +58 -6
- package/skills/ux-architecture/SKILL.md +4 -0
- package/src/browser/event-controller.ts +265 -4
- package/src/browser/fetched-loader-handles.ts +227 -54
- package/src/browser/navigation-store.ts +261 -2
- package/src/browser/partial-update.ts +3 -2
- package/src/browser/react/use-handle.ts +74 -27
- package/src/browser/react/use-push-handle.ts +113 -0
- package/src/browser/rsc-router.tsx +11 -14
- package/src/browser/types.ts +48 -0
- package/src/cache/document-cache-policy.ts +6 -5
- package/src/client.rsc.tsx +1 -0
- package/src/client.tsx +31 -1
- package/src/handle.ts +13 -5
- package/src/handles/client-pushes.ts +120 -0
- package/src/handles/deferred-resolution.ts +12 -0
- package/src/handles/pushed-by.ts +55 -1
- package/src/loader-store.ts +26 -0
- package/src/rsc/loader-fetch.ts +17 -0
- package/src/rsc/prefetch-render-error.ts +2 -1
- package/src/rsc/request-stages.ts +7 -6
- package/src/rsc/rsc-rendering.ts +32 -14
- package/src/server/handle-store.ts +23 -0
- package/src/ssr/ssr-root.tsx +5 -0
- package/src/testing/dom.entry.ts +2 -0
- package/src/testing/render-route.tsx +317 -72
- package/src/use-loader.tsx +16 -5
package/src/use-loader.tsx
CHANGED
|
@@ -303,7 +303,10 @@ function useLoaderInternal<T>(
|
|
|
303
303
|
try {
|
|
304
304
|
const url = new URL(window.location.href);
|
|
305
305
|
url.searchParams.set("_rsc_loader", loaderId);
|
|
306
|
-
const
|
|
306
|
+
const landRead = startFetchedLoaderRead(loaderId, page, {
|
|
307
|
+
bucketKey,
|
|
308
|
+
requestId,
|
|
309
|
+
});
|
|
307
310
|
const response = fetch(url.toString(), {
|
|
308
311
|
method: "GET",
|
|
309
312
|
headers: { Accept: "text/x-component" },
|
|
@@ -314,7 +317,7 @@ function useLoaderInternal<T>(
|
|
|
314
317
|
throw new Error(payload.loaderError.message);
|
|
315
318
|
}
|
|
316
319
|
loaders.finishData(bucketKey, requestId, payload.loaderResult);
|
|
317
|
-
|
|
320
|
+
landRead(payload.loaderResult, payload.handles, payload.pushedBy);
|
|
318
321
|
} catch (e) {
|
|
319
322
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
320
323
|
loaders.finishError(bucketKey, requestId, err);
|
|
@@ -570,8 +573,16 @@ function useLoaderInternal<T>(
|
|
|
570
573
|
// Only a refetch of the page's own read (the page's params, no body)
|
|
571
574
|
// applies its handle values: a read with other params or a body is
|
|
572
575
|
// data the page does not show, and its pushes would retitle the page.
|
|
573
|
-
|
|
574
|
-
|
|
576
|
+
// A read that keeps its data local keeps its values local too
|
|
577
|
+
// (fetched-loader-handles.ts).
|
|
578
|
+
const landRead = isPlainRefetch(loadOptions)
|
|
579
|
+
? startFetchedLoaderRead(
|
|
580
|
+
id,
|
|
581
|
+
page,
|
|
582
|
+
shared
|
|
583
|
+
? { bucketKey: bucket, requestId: sharedRequestId }
|
|
584
|
+
: undefined,
|
|
585
|
+
)
|
|
575
586
|
: undefined;
|
|
576
587
|
const response = fetch(url.toString(), fetchOptions);
|
|
577
588
|
|
|
@@ -591,7 +602,7 @@ function useLoaderInternal<T>(
|
|
|
591
602
|
setLocalIsLoading(false);
|
|
592
603
|
});
|
|
593
604
|
}
|
|
594
|
-
|
|
605
|
+
landRead?.(result, payload.handles, payload.pushedBy);
|
|
595
606
|
return result;
|
|
596
607
|
} catch (e) {
|
|
597
608
|
const err = e instanceof Error ? e : new Error(String(e));
|