react-router 0.0.0-experimental-5bbc45fb6 → 0.0.0-experimental-b7b187661
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/development/{chunk-EKICUOCX.mjs → chunk-2FQIWOOW.mjs} +90 -20
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +28 -14
- package/dist/development/index.d.ts +26 -12
- package/dist/development/index.js +90 -20
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/internal.d.mts +4 -2
- package/dist/development/lib/types/internal.d.ts +4 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/lib-DOOHL1pK.d.mts → development/lib-DRnPBLeb.d.mts} +1 -1
- package/dist/{production/register-DEZBC9Yl.d.ts → development/register-BPC2Sp5k.d.ts} +1 -1
- package/dist/{production/route-data-BwJdBC92.d.mts → development/route-data-Wlht-qYx.d.mts} +1 -1
- package/dist/production/{chunk-5UK3OH7I.mjs → chunk-S4UEUDP2.mjs} +90 -20
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +28 -14
- package/dist/production/index.d.ts +26 -12
- package/dist/production/index.js +90 -20
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/internal.d.mts +4 -2
- package/dist/production/lib/types/internal.d.ts +4 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/lib-DOOHL1pK.d.mts → production/lib-DRnPBLeb.d.mts} +1 -1
- package/dist/{development/register-DEZBC9Yl.d.ts → production/register-BPC2Sp5k.d.ts} +1 -1
- package/dist/{development/route-data-BwJdBC92.d.mts → production/route-data-Wlht-qYx.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-b7b187661
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2796,12 +2796,16 @@ function createStaticHandler(routes, opts) {
|
|
|
2796
2796
|
dataRoutes,
|
|
2797
2797
|
renderedStaticContext,
|
|
2798
2798
|
error,
|
|
2799
|
-
findNearestBoundary(matches, routeId).route.id
|
|
2799
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2800
2800
|
)
|
|
2801
2801
|
);
|
|
2802
2802
|
} else {
|
|
2803
|
-
let
|
|
2804
|
-
|
|
2803
|
+
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2804
|
+
matches,
|
|
2805
|
+
matches.find(
|
|
2806
|
+
(m) => m.route.id === routeId || m.route.loader
|
|
2807
|
+
)?.route.id || routeId
|
|
2808
|
+
).route.id;
|
|
2805
2809
|
return respond({
|
|
2806
2810
|
matches,
|
|
2807
2811
|
location,
|
|
@@ -2809,7 +2813,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2809
2813
|
loaderData: {},
|
|
2810
2814
|
actionData: null,
|
|
2811
2815
|
errors: {
|
|
2812
|
-
[
|
|
2816
|
+
[boundaryRouteId]: error
|
|
2813
2817
|
},
|
|
2814
2818
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2815
2819
|
actionHeaders: {},
|
|
@@ -5253,14 +5257,12 @@ function useNavigation() {
|
|
|
5253
5257
|
function useRevalidator() {
|
|
5254
5258
|
let dataRouterContext = useDataRouterContext("useRevalidator" /* UseRevalidator */);
|
|
5255
5259
|
let state = useDataRouterState("useRevalidator" /* UseRevalidator */);
|
|
5260
|
+
let revalidate = React2.useCallback(async () => {
|
|
5261
|
+
await dataRouterContext.router.revalidate();
|
|
5262
|
+
}, [dataRouterContext.router]);
|
|
5256
5263
|
return React2.useMemo(
|
|
5257
|
-
() => ({
|
|
5258
|
-
|
|
5259
|
-
await dataRouterContext.router.revalidate();
|
|
5260
|
-
},
|
|
5261
|
-
state: state.revalidation
|
|
5262
|
-
}),
|
|
5263
|
-
[dataRouterContext.router, state.revalidation]
|
|
5264
|
+
() => ({ revalidate, state: state.revalidation }),
|
|
5265
|
+
[revalidate, state.revalidation]
|
|
5264
5266
|
);
|
|
5265
5267
|
}
|
|
5266
5268
|
function useMatches() {
|
|
@@ -6992,6 +6994,8 @@ async function createRequestInit(request) {
|
|
|
6992
6994
|
|
|
6993
6995
|
// lib/dom/ssr/single-fetch.tsx
|
|
6994
6996
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
6997
|
+
var SingleFetchNoResultError = class extends Error {
|
|
6998
|
+
};
|
|
6995
6999
|
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
6996
7000
|
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
6997
7001
|
function StreamTransfer({
|
|
@@ -7218,8 +7222,39 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
7218
7222
|
}
|
|
7219
7223
|
}
|
|
7220
7224
|
await resolvePromise;
|
|
7225
|
+
await bubbleMiddlewareErrors(
|
|
7226
|
+
singleFetchDfd.promise,
|
|
7227
|
+
args.matches,
|
|
7228
|
+
routesParams,
|
|
7229
|
+
results
|
|
7230
|
+
);
|
|
7221
7231
|
return results;
|
|
7222
7232
|
}
|
|
7233
|
+
async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams, results) {
|
|
7234
|
+
try {
|
|
7235
|
+
let middlewareError;
|
|
7236
|
+
let fetchedData = await singleFetchPromise;
|
|
7237
|
+
if ("routes" in fetchedData) {
|
|
7238
|
+
for (let match of matches) {
|
|
7239
|
+
if (match.route.id in fetchedData.routes) {
|
|
7240
|
+
let routeResult = fetchedData.routes[match.route.id];
|
|
7241
|
+
if ("error" in routeResult) {
|
|
7242
|
+
middlewareError = routeResult.error;
|
|
7243
|
+
break;
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7247
|
+
}
|
|
7248
|
+
if (middlewareError !== void 0) {
|
|
7249
|
+
Array.from(routesParams.values()).forEach((routeId) => {
|
|
7250
|
+
if (results[routeId].result instanceof SingleFetchNoResultError) {
|
|
7251
|
+
results[routeId].result = middlewareError;
|
|
7252
|
+
}
|
|
7253
|
+
});
|
|
7254
|
+
}
|
|
7255
|
+
} catch (e) {
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7223
7258
|
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename) {
|
|
7224
7259
|
let fetcherMatch = args.matches.find((m) => m.unstable_shouldCallHandler());
|
|
7225
7260
|
invariant2(fetcherMatch, "No fetcher match found");
|
|
@@ -7378,12 +7413,16 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
7378
7413
|
});
|
|
7379
7414
|
}
|
|
7380
7415
|
let routeResult = result.routes[routeId];
|
|
7381
|
-
if (
|
|
7416
|
+
if (routeResult == null) {
|
|
7417
|
+
throw new SingleFetchNoResultError(
|
|
7418
|
+
`No result found for routeId "${routeId}"`
|
|
7419
|
+
);
|
|
7420
|
+
} else if ("error" in routeResult) {
|
|
7382
7421
|
throw routeResult.error;
|
|
7383
7422
|
} else if ("data" in routeResult) {
|
|
7384
7423
|
return routeResult.data;
|
|
7385
7424
|
} else {
|
|
7386
|
-
throw new Error(`
|
|
7425
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
7387
7426
|
}
|
|
7388
7427
|
}
|
|
7389
7428
|
function createDeferred2() {
|
|
@@ -8640,7 +8679,7 @@ function mergeRefs(...refs) {
|
|
|
8640
8679
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8641
8680
|
try {
|
|
8642
8681
|
if (isBrowser) {
|
|
8643
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8682
|
+
window.__reactRouterVersion = "0.0.0-experimental-b7b187661";
|
|
8644
8683
|
}
|
|
8645
8684
|
} catch (e) {
|
|
8646
8685
|
}
|
|
@@ -9834,6 +9873,37 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
9834
9873
|
return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
|
|
9835
9874
|
};
|
|
9836
9875
|
}
|
|
9876
|
+
function withComponentProps(Component4) {
|
|
9877
|
+
return function Wrapped() {
|
|
9878
|
+
return React13.createElement(Component4, {
|
|
9879
|
+
params: useParams(),
|
|
9880
|
+
loaderData: useLoaderData(),
|
|
9881
|
+
actionData: useActionData(),
|
|
9882
|
+
matches: useMatches()
|
|
9883
|
+
});
|
|
9884
|
+
};
|
|
9885
|
+
}
|
|
9886
|
+
function withHydrateFallbackProps(HydrateFallback) {
|
|
9887
|
+
return function Wrapped() {
|
|
9888
|
+
const props = {
|
|
9889
|
+
params: useParams(),
|
|
9890
|
+
loaderData: useLoaderData(),
|
|
9891
|
+
actionData: useActionData()
|
|
9892
|
+
};
|
|
9893
|
+
return React13.createElement(HydrateFallback, props);
|
|
9894
|
+
};
|
|
9895
|
+
}
|
|
9896
|
+
function withErrorBoundaryProps(ErrorBoundary) {
|
|
9897
|
+
return function Wrapped() {
|
|
9898
|
+
const props = {
|
|
9899
|
+
params: useParams(),
|
|
9900
|
+
loaderData: useLoaderData(),
|
|
9901
|
+
actionData: useActionData(),
|
|
9902
|
+
error: useRouteError()
|
|
9903
|
+
};
|
|
9904
|
+
return React13.createElement(ErrorBoundary, props);
|
|
9905
|
+
};
|
|
9906
|
+
}
|
|
9837
9907
|
function processRoutes(routes, manifest, routeModules, parentId) {
|
|
9838
9908
|
return routes.map((route) => {
|
|
9839
9909
|
if (!route.id) {
|
|
@@ -9845,9 +9915,9 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9845
9915
|
id: route.id,
|
|
9846
9916
|
path: route.path,
|
|
9847
9917
|
index: route.index,
|
|
9848
|
-
Component: route.Component,
|
|
9849
|
-
HydrateFallback: route.HydrateFallback,
|
|
9850
|
-
ErrorBoundary: route.ErrorBoundary,
|
|
9918
|
+
Component: route.Component ? withComponentProps(route.Component) : void 0,
|
|
9919
|
+
HydrateFallback: route.HydrateFallback ? withHydrateFallbackProps(route.HydrateFallback) : void 0,
|
|
9920
|
+
ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
|
|
9851
9921
|
action: route.action,
|
|
9852
9922
|
loader: route.loader,
|
|
9853
9923
|
handle: route.handle,
|
|
@@ -9876,8 +9946,8 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9876
9946
|
};
|
|
9877
9947
|
manifest.routes[newRoute.id] = entryRoute;
|
|
9878
9948
|
routeModules[route.id] = {
|
|
9879
|
-
default:
|
|
9880
|
-
ErrorBoundary:
|
|
9949
|
+
default: newRoute.Component || Outlet,
|
|
9950
|
+
ErrorBoundary: newRoute.ErrorBoundary || void 0,
|
|
9881
9951
|
handle: route.handle,
|
|
9882
9952
|
links: route.links,
|
|
9883
9953
|
meta: route.meta,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './lib-
|
|
3
|
-
import { R as RouterInit } from './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './lib-DRnPBLeb.mjs';
|
|
3
|
+
import { R as RouterInit } from './route-data-Wlht-qYx.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-b7b187661
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
invariant,
|
|
26
26
|
mapRouteProperties,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-2FQIWOOW.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Router, b as RouteModules, D as DataStrategyFunction, T as To, c as RelativeRoutingType, L as Location, A as Action, P as ParamParseKey, d as Path, e as PathPattern, f as PathMatch, N as NavigateOptions, g as Params, h as RouteObject, i as Navigation,
|
|
2
|
-
export { W as ActionFunctionArgs, av as ClientActionFunction, aw as ClientActionFunctionArgs, ax as ClientLoaderFunctionArgs, ar as DataRouteMatch, X as DataStrategyFunctionArgs, Y as DataStrategyMatch, Z as DataStrategyResult, $ as ErrorResponse,
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, S as ServerBuild } from './lib-
|
|
4
|
-
export { f as Await, a as AwaitProps, Q as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, v as FetcherFormProps, C as FetcherSubmitFunction, a6 as FetcherSubmitOptions, G as FetcherWithComponents, X as Form, w as FormProps, ah as HandleDataRequestFunction, ai as HandleDocumentRequestFunction, aj as HandleErrorFunction, T as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, U as Link, s as LinkProps, ad as Links, g as MemoryRouter, M as MemoryRouterOpts, b as MemoryRouterProps, ac as Meta, W as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a7 as ParamKeyValuePair, P as PathRouteProps, af as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ae as Scripts, ag as ScriptsProps, Y as ScrollRestoration, x as ScrollRestorationProps, ak as ServerEntryModule, y as SetURLSearchParams, z as SubmitFunction, a8 as SubmitOptions, aa as SubmitTarget, an as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_hydrationRouteProperties, am as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, ar as UNSAFE_useScrollRestoration, a9 as URLSearchParamsInit, J as createBrowserRouter, K as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, ab as createSearchParams, r as renderMatches, V as unstable_HistoryRouter, a4 as unstable_usePrompt, a3 as useBeforeUnload, a1 as useFetcher, a2 as useFetchers, a0 as useFormAction, Z as useLinkClickHandler, _ as useSearchParams, $ as useSubmit, a5 as useViewTransitionState } from './lib-
|
|
1
|
+
import { a as Router, b as RouteModules, D as DataStrategyFunction, T as To, c as RelativeRoutingType, L as Location, A as Action, P as ParamParseKey, d as Path, e as PathPattern, f as PathMatch, N as NavigateOptions, g as Params, h as RouteObject, i as Navigation, U as UIMatch, S as SerializeFrom, B as BlockerFunction, j as Blocker, k as StaticHandlerContext, l as StaticHandler, F as FutureConfig, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, u as unstable_InitialContext, m as IndexRouteObject, n as NonIndexRouteObject, o as LoaderFunction, p as ActionFunction, M as MetaFunction, q as LinksFunction, r as MiddlewareEnabled, s as AppLoadContext, E as Equal, t as RouterState, v as PatchRoutesOnNavigationFunction, w as DataRouteObject, x as ClientLoaderFunction } from './route-data-Wlht-qYx.mjs';
|
|
2
|
+
export { W as ActionFunctionArgs, av as ClientActionFunction, aw as ClientActionFunctionArgs, ax as ClientLoaderFunctionArgs, ar as DataRouteMatch, X as DataStrategyFunctionArgs, Y as DataStrategyMatch, Z as DataStrategyResult, $ as ErrorResponse, z as Fetcher, a0 as FormEncType, a1 as FormMethod, aF as Future, G as GetScrollPositionFunction, y as GetScrollRestorationKeyFunction, a2 as HTMLFormMethod, ay as HeadersArgs, az as HeadersFunction, aD as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a3 as LazyRouteFunction, aE as LinkDescriptor, a4 as LoaderFunctionArgs, aA as MetaArgs, aB as MetaDescriptor, J as NavigationStates, as as Navigator, aC as PageLinkDescriptor, at as PatchRoutesOnNavigationFunctionArgs, a6 as PathParam, a7 as RedirectFunction, V as RevalidationState, au as RouteMatch, Q as RouterFetchOptions, R as RouterInit, O as RouterNavigateOptions, K as RouterSubscriber, a9 as ShouldRevalidateFunction, aa as ShouldRevalidateFunctionArgs, aL as UNSAFE_DataRouterContext, aM as UNSAFE_DataRouterStateContext, _ as UNSAFE_DataWithResponseInit, aK as UNSAFE_ErrorResponseImpl, aN as UNSAFE_FetchersContext, aO as UNSAFE_LocationContext, aP as UNSAFE_NavigationContext, aQ as UNSAFE_RouteContext, aR as UNSAFE_ViewTransitionContext, aH as UNSAFE_createBrowserHistory, aJ as UNSAFE_createRouter, aI as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a5 as unstable_MiddlewareFunction, a8 as unstable_RouterContext, ac as unstable_RouterContextProvider, aG as unstable_SerializesTo, ab as unstable_createContext } from './route-data-Wlht-qYx.mjs';
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, S as ServerBuild } from './lib-DRnPBLeb.mjs';
|
|
4
|
+
export { f as Await, a as AwaitProps, Q as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, v as FetcherFormProps, C as FetcherSubmitFunction, a6 as FetcherSubmitOptions, G as FetcherWithComponents, X as Form, w as FormProps, ah as HandleDataRequestFunction, ai as HandleDocumentRequestFunction, aj as HandleErrorFunction, T as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, U as Link, s as LinkProps, ad as Links, g as MemoryRouter, M as MemoryRouterOpts, b as MemoryRouterProps, ac as Meta, W as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a7 as ParamKeyValuePair, P as PathRouteProps, af as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ae as Scripts, ag as ScriptsProps, Y as ScrollRestoration, x as ScrollRestorationProps, ak as ServerEntryModule, y as SetURLSearchParams, z as SubmitFunction, a8 as SubmitOptions, aa as SubmitTarget, an as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_hydrationRouteProperties, am as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, ar as UNSAFE_useScrollRestoration, a9 as URLSearchParamsInit, J as createBrowserRouter, K as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, ab as createSearchParams, r as renderMatches, V as unstable_HistoryRouter, a4 as unstable_usePrompt, a3 as useBeforeUnload, a1 as useFetcher, a2 as useFetchers, a0 as useFormAction, Z as useLinkClickHandler, _ as useSearchParams, $ as useSubmit, a5 as useViewTransitionState } from './lib-DRnPBLeb.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -244,8 +244,8 @@ declare function useNavigation(): Navigation;
|
|
|
244
244
|
@category Hooks
|
|
245
245
|
*/
|
|
246
246
|
declare function useRevalidator(): {
|
|
247
|
-
revalidate()
|
|
248
|
-
state:
|
|
247
|
+
revalidate: () => Promise<void>;
|
|
248
|
+
state: Router["state"]["revalidation"];
|
|
249
249
|
};
|
|
250
250
|
/**
|
|
251
251
|
* Returns the active route matches, useful for accessing loaderData for
|
|
@@ -442,19 +442,33 @@ interface ServerRouterProps {
|
|
|
442
442
|
*/
|
|
443
443
|
declare function ServerRouter({ context, url, nonce, }: ServerRouterProps): ReactElement;
|
|
444
444
|
|
|
445
|
-
interface
|
|
445
|
+
interface StubRouteExtensions {
|
|
446
|
+
Component?: React.ComponentType<{
|
|
447
|
+
params: ReturnType<typeof useParams>;
|
|
448
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
449
|
+
actionData: ReturnType<typeof useActionData>;
|
|
450
|
+
matches: ReturnType<typeof useMatches>;
|
|
451
|
+
}>;
|
|
452
|
+
HydrateFallback?: React.ComponentType<{
|
|
453
|
+
params: ReturnType<typeof useParams>;
|
|
454
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
455
|
+
actionData: ReturnType<typeof useActionData>;
|
|
456
|
+
}>;
|
|
457
|
+
ErrorBoundary?: React.ComponentType<{
|
|
458
|
+
params: ReturnType<typeof useParams>;
|
|
459
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
460
|
+
actionData: ReturnType<typeof useActionData>;
|
|
461
|
+
error: ReturnType<typeof useRouteError>;
|
|
462
|
+
}>;
|
|
446
463
|
loader?: LoaderFunction;
|
|
447
464
|
action?: ActionFunction;
|
|
448
465
|
children?: StubRouteObject[];
|
|
449
466
|
meta?: MetaFunction;
|
|
450
467
|
links?: LinksFunction;
|
|
451
468
|
}
|
|
452
|
-
interface
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
children?: StubRouteObject[];
|
|
456
|
-
meta?: MetaFunction;
|
|
457
|
-
links?: LinksFunction;
|
|
469
|
+
interface StubIndexRouteObject extends Omit<IndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
|
470
|
+
}
|
|
471
|
+
interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
|
458
472
|
}
|
|
459
473
|
type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
|
|
460
474
|
interface RoutesTestStubProps {
|
|
@@ -792,4 +806,4 @@ declare function getHydrationData(state: {
|
|
|
792
806
|
hasHydrateFallback: boolean;
|
|
793
807
|
}, location: Path, basename: string | undefined, isSpaMode: boolean): HydrationState;
|
|
794
808
|
|
|
795
|
-
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, Register, RelativeRoutingType, type RequestHandler,
|
|
809
|
+
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, Register, RelativeRoutingType, type RequestHandler, RouteObject, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, unstable_InitialContext, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteObject, a as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, b as Router$1, T as To, c as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, d as IndexRouteObject, e as Location, A as Action, f as Navigator, g as RouteMatch, h as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, i as AppLoadContext, j as LoaderFunctionArgs, k as ActionFunctionArgs, l as StaticHandlerContext, m as RouteModules, n as DataRouteObject, C as ClientLoaderFunction, o as ParamParseKey, p as Path, q as PathPattern, r as PathMatch, s as NavigateOptions, t as Params, v as Navigation,
|
|
2
|
-
export { aA as ClientActionFunction, aB as ClientActionFunctionArgs, aC as ClientLoaderFunctionArgs, ay as DataRouteMatch, a7 as DataStrategyFunctionArgs, a8 as DataStrategyMatch, a9 as DataStrategyResult, ab as ErrorResponse, ac as FormMethod, aJ as Future,
|
|
1
|
+
import { R as RouteObject, a as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, b as Router$1, T as To, c as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, d as IndexRouteObject, e as Location, A as Action, f as Navigator, g as RouteMatch, h as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, i as AppLoadContext, j as LoaderFunctionArgs, k as ActionFunctionArgs, l as StaticHandlerContext, m as RouteModules, n as DataRouteObject, C as ClientLoaderFunction, o as ParamParseKey, p as Path, q as PathPattern, r as PathMatch, s as NavigateOptions, t as Params, v as Navigation, U as UIMatch, w as SerializeFrom, B as BlockerFunction, x as Blocker, y as HTMLFormMethod, z as FormEncType, E as PageLinkDescriptor, G as History, J as GetScrollRestorationKeyFunction, K as Fetcher, O as StaticHandler, Q as CreateStaticHandlerOptions$1, V as unstable_InitialContext, W as LoaderFunction, X as ActionFunction, Y as MetaFunction, Z as LinksFunction, _ as Equal, $ as Register, a0 as RouterState } from './register-BPC2Sp5k.js';
|
|
2
|
+
export { aA as ClientActionFunction, aB as ClientActionFunctionArgs, aC as ClientLoaderFunctionArgs, ay as DataRouteMatch, a7 as DataStrategyFunctionArgs, a8 as DataStrategyMatch, a9 as DataStrategyResult, ab as ErrorResponse, ac as FormMethod, aJ as Future, a1 as GetScrollPositionFunction, aD as HeadersArgs, aE as HeadersFunction, aH as HtmlLinkDescriptor, ao as IDLE_BLOCKER, an as IDLE_FETCHER, am as IDLE_NAVIGATION, aI as LinkDescriptor, aF as MetaArgs, aG as MetaDescriptor, a2 as NavigationStates, az as PatchRoutesOnNavigationFunctionArgs, ae as PathParam, af as RedirectFunction, a6 as RevalidationState, a5 as RouterFetchOptions, a4 as RouterNavigateOptions, a3 as RouterSubscriber, ah as ShouldRevalidateFunction, ai as ShouldRevalidateFunctionArgs, aP as UNSAFE_DataRouterContext, aQ as UNSAFE_DataRouterStateContext, aa as UNSAFE_DataWithResponseInit, aO as UNSAFE_ErrorResponseImpl, aR as UNSAFE_FetchersContext, aS as UNSAFE_LocationContext, aT as UNSAFE_NavigationContext, aU as UNSAFE_RouteContext, aV as UNSAFE_ViewTransitionContext, aL as UNSAFE_createBrowserHistory, aN as UNSAFE_createRouter, aM as UNSAFE_invariant, ak as createPath, ap as data, aq as generatePath, ar as isRouteErrorResponse, as as matchPath, at as matchRoutes, al as parsePath, au as redirect, av as redirectDocument, aw as replace, ax as resolvePath, ad as unstable_MiddlewareFunction, ag as unstable_RouterContext, aK as unstable_SerializesTo, aj as unstable_createContext } from './register-BPC2Sp5k.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ReactElement } from 'react';
|
|
5
5
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -785,8 +785,8 @@ declare function useNavigation(): Navigation;
|
|
|
785
785
|
@category Hooks
|
|
786
786
|
*/
|
|
787
787
|
declare function useRevalidator(): {
|
|
788
|
-
revalidate()
|
|
789
|
-
state:
|
|
788
|
+
revalidate: () => Promise<void>;
|
|
789
|
+
state: Router$1["state"]["revalidation"];
|
|
790
790
|
};
|
|
791
791
|
/**
|
|
792
792
|
* Returns the active route matches, useful for accessing loaderData for
|
|
@@ -2171,19 +2171,33 @@ interface ServerRouterProps {
|
|
|
2171
2171
|
*/
|
|
2172
2172
|
declare function ServerRouter({ context, url, nonce, }: ServerRouterProps): ReactElement;
|
|
2173
2173
|
|
|
2174
|
-
interface
|
|
2174
|
+
interface StubRouteExtensions {
|
|
2175
|
+
Component?: React.ComponentType<{
|
|
2176
|
+
params: ReturnType<typeof useParams>;
|
|
2177
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
2178
|
+
actionData: ReturnType<typeof useActionData>;
|
|
2179
|
+
matches: ReturnType<typeof useMatches>;
|
|
2180
|
+
}>;
|
|
2181
|
+
HydrateFallback?: React.ComponentType<{
|
|
2182
|
+
params: ReturnType<typeof useParams>;
|
|
2183
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
2184
|
+
actionData: ReturnType<typeof useActionData>;
|
|
2185
|
+
}>;
|
|
2186
|
+
ErrorBoundary?: React.ComponentType<{
|
|
2187
|
+
params: ReturnType<typeof useParams>;
|
|
2188
|
+
loaderData: ReturnType<typeof useLoaderData>;
|
|
2189
|
+
actionData: ReturnType<typeof useActionData>;
|
|
2190
|
+
error: ReturnType<typeof useRouteError>;
|
|
2191
|
+
}>;
|
|
2175
2192
|
loader?: LoaderFunction;
|
|
2176
2193
|
action?: ActionFunction;
|
|
2177
2194
|
children?: StubRouteObject[];
|
|
2178
2195
|
meta?: MetaFunction;
|
|
2179
2196
|
links?: LinksFunction;
|
|
2180
2197
|
}
|
|
2181
|
-
interface
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
children?: StubRouteObject[];
|
|
2185
|
-
meta?: MetaFunction;
|
|
2186
|
-
links?: LinksFunction;
|
|
2198
|
+
interface StubIndexRouteObject extends Omit<IndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
|
2199
|
+
}
|
|
2200
|
+
interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
|
2187
2201
|
}
|
|
2188
2202
|
type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
|
|
2189
2203
|
interface RoutesTestStubProps {
|
|
@@ -2521,4 +2535,4 @@ declare function getHydrationData(state: {
|
|
|
2521
2535
|
hasHydrateFallback: boolean;
|
|
2522
2536
|
}, location: Path, basename: string | undefined, isSpaMode: boolean): HydrationState;
|
|
2523
2537
|
|
|
2524
|
-
export { ActionFunction, ActionFunctionArgs, AppLoadContext, Await, type AwaitProps, Blocker, BlockerFunction, BrowserRouter, type BrowserRouterProps, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, DataRouteObject, Router$1 as DataRouter, DataStrategyFunction, type EntryContext, Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, FormEncType, type FormProps, GetScrollRestorationKeyFunction, HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HistoryRouterProps, HydrationState, IndexRouteObject, type IndexRouteProps, InitialEntry, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, LazyRouteFunction, Link, type LinkProps, Links, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, MetaFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, NavigateOptions, type NavigateProps, Navigation, Action as NavigationType, Navigator, NonIndexRouteObject, Outlet, type OutletProps, PageLinkDescriptor, type ParamKeyValuePair, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, type PathRouteProps, PrefetchPageLinks, Register, RelativeRoutingType, type RequestHandler,
|
|
2538
|
+
export { ActionFunction, ActionFunctionArgs, AppLoadContext, Await, type AwaitProps, Blocker, BlockerFunction, BrowserRouter, type BrowserRouterProps, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, DataRouteObject, Router$1 as DataRouter, DataStrategyFunction, type EntryContext, Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, FormEncType, type FormProps, GetScrollRestorationKeyFunction, HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HistoryRouterProps, HydrationState, IndexRouteObject, type IndexRouteProps, InitialEntry, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, LazyRouteFunction, Link, type LinkProps, Links, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, MetaFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, NavigateOptions, type NavigateProps, Navigation, Action as NavigationType, Navigator, NonIndexRouteObject, Outlet, type OutletProps, PageLinkDescriptor, type ParamKeyValuePair, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, type PathRouteProps, PrefetchPageLinks, Register, RelativeRoutingType, type RequestHandler, Route$1 as Route, RouteMatch, RouteObject, type RouteProps, Router, RouterInit, type RouterProps, RouterProvider, type RouterProviderProps, RouterState, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, To, UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, FrameworkContext as UNSAFE_FrameworkContext, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, mapRouteProperties as UNSAFE_mapRouteProperties, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, type URLSearchParamsInit, createBrowserRouter, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, renderMatches, HistoryRouter as unstable_HistoryRouter, unstable_InitialContext, unstable_RouterContextProvider, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-b7b187661
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2946,12 +2946,16 @@ function createStaticHandler(routes, opts) {
|
|
|
2946
2946
|
dataRoutes,
|
|
2947
2947
|
renderedStaticContext,
|
|
2948
2948
|
error,
|
|
2949
|
-
findNearestBoundary(matches, routeId).route.id
|
|
2949
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2950
2950
|
)
|
|
2951
2951
|
);
|
|
2952
2952
|
} else {
|
|
2953
|
-
let
|
|
2954
|
-
|
|
2953
|
+
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2954
|
+
matches,
|
|
2955
|
+
matches.find(
|
|
2956
|
+
(m) => m.route.id === routeId || m.route.loader
|
|
2957
|
+
)?.route.id || routeId
|
|
2958
|
+
).route.id;
|
|
2955
2959
|
return respond({
|
|
2956
2960
|
matches,
|
|
2957
2961
|
location,
|
|
@@ -2959,7 +2963,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2959
2963
|
loaderData: {},
|
|
2960
2964
|
actionData: null,
|
|
2961
2965
|
errors: {
|
|
2962
|
-
[
|
|
2966
|
+
[boundaryRouteId]: error
|
|
2963
2967
|
},
|
|
2964
2968
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2965
2969
|
actionHeaders: {},
|
|
@@ -5403,14 +5407,12 @@ function useNavigation() {
|
|
|
5403
5407
|
function useRevalidator() {
|
|
5404
5408
|
let dataRouterContext = useDataRouterContext("useRevalidator" /* UseRevalidator */);
|
|
5405
5409
|
let state = useDataRouterState("useRevalidator" /* UseRevalidator */);
|
|
5410
|
+
let revalidate = React2.useCallback(async () => {
|
|
5411
|
+
await dataRouterContext.router.revalidate();
|
|
5412
|
+
}, [dataRouterContext.router]);
|
|
5406
5413
|
return React2.useMemo(
|
|
5407
|
-
() => ({
|
|
5408
|
-
|
|
5409
|
-
await dataRouterContext.router.revalidate();
|
|
5410
|
-
},
|
|
5411
|
-
state: state.revalidation
|
|
5412
|
-
}),
|
|
5413
|
-
[dataRouterContext.router, state.revalidation]
|
|
5414
|
+
() => ({ revalidate, state: state.revalidation }),
|
|
5415
|
+
[revalidate, state.revalidation]
|
|
5414
5416
|
);
|
|
5415
5417
|
}
|
|
5416
5418
|
function useMatches() {
|
|
@@ -7142,6 +7144,8 @@ async function createRequestInit(request) {
|
|
|
7142
7144
|
|
|
7143
7145
|
// lib/dom/ssr/single-fetch.tsx
|
|
7144
7146
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
7147
|
+
var SingleFetchNoResultError = class extends Error {
|
|
7148
|
+
};
|
|
7145
7149
|
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
7146
7150
|
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
7147
7151
|
function StreamTransfer({
|
|
@@ -7368,8 +7372,39 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
7368
7372
|
}
|
|
7369
7373
|
}
|
|
7370
7374
|
await resolvePromise;
|
|
7375
|
+
await bubbleMiddlewareErrors(
|
|
7376
|
+
singleFetchDfd.promise,
|
|
7377
|
+
args.matches,
|
|
7378
|
+
routesParams,
|
|
7379
|
+
results
|
|
7380
|
+
);
|
|
7371
7381
|
return results;
|
|
7372
7382
|
}
|
|
7383
|
+
async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams, results) {
|
|
7384
|
+
try {
|
|
7385
|
+
let middlewareError;
|
|
7386
|
+
let fetchedData = await singleFetchPromise;
|
|
7387
|
+
if ("routes" in fetchedData) {
|
|
7388
|
+
for (let match of matches) {
|
|
7389
|
+
if (match.route.id in fetchedData.routes) {
|
|
7390
|
+
let routeResult = fetchedData.routes[match.route.id];
|
|
7391
|
+
if ("error" in routeResult) {
|
|
7392
|
+
middlewareError = routeResult.error;
|
|
7393
|
+
break;
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
if (middlewareError !== void 0) {
|
|
7399
|
+
Array.from(routesParams.values()).forEach((routeId) => {
|
|
7400
|
+
if (results[routeId].result instanceof SingleFetchNoResultError) {
|
|
7401
|
+
results[routeId].result = middlewareError;
|
|
7402
|
+
}
|
|
7403
|
+
});
|
|
7404
|
+
}
|
|
7405
|
+
} catch (e) {
|
|
7406
|
+
}
|
|
7407
|
+
}
|
|
7373
7408
|
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename) {
|
|
7374
7409
|
let fetcherMatch = args.matches.find((m) => m.unstable_shouldCallHandler());
|
|
7375
7410
|
invariant2(fetcherMatch, "No fetcher match found");
|
|
@@ -7528,12 +7563,16 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
7528
7563
|
});
|
|
7529
7564
|
}
|
|
7530
7565
|
let routeResult = result.routes[routeId];
|
|
7531
|
-
if (
|
|
7566
|
+
if (routeResult == null) {
|
|
7567
|
+
throw new SingleFetchNoResultError(
|
|
7568
|
+
`No result found for routeId "${routeId}"`
|
|
7569
|
+
);
|
|
7570
|
+
} else if ("error" in routeResult) {
|
|
7532
7571
|
throw routeResult.error;
|
|
7533
7572
|
} else if ("data" in routeResult) {
|
|
7534
7573
|
return routeResult.data;
|
|
7535
7574
|
} else {
|
|
7536
|
-
throw new Error(`
|
|
7575
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
7537
7576
|
}
|
|
7538
7577
|
}
|
|
7539
7578
|
function createDeferred2() {
|
|
@@ -8790,7 +8829,7 @@ function mergeRefs(...refs) {
|
|
|
8790
8829
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8791
8830
|
try {
|
|
8792
8831
|
if (isBrowser) {
|
|
8793
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8832
|
+
window.__reactRouterVersion = "0.0.0-experimental-b7b187661";
|
|
8794
8833
|
}
|
|
8795
8834
|
} catch (e) {
|
|
8796
8835
|
}
|
|
@@ -9984,6 +10023,37 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
9984
10023
|
return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
|
|
9985
10024
|
};
|
|
9986
10025
|
}
|
|
10026
|
+
function withComponentProps(Component4) {
|
|
10027
|
+
return function Wrapped() {
|
|
10028
|
+
return React13.createElement(Component4, {
|
|
10029
|
+
params: useParams(),
|
|
10030
|
+
loaderData: useLoaderData(),
|
|
10031
|
+
actionData: useActionData(),
|
|
10032
|
+
matches: useMatches()
|
|
10033
|
+
});
|
|
10034
|
+
};
|
|
10035
|
+
}
|
|
10036
|
+
function withHydrateFallbackProps(HydrateFallback) {
|
|
10037
|
+
return function Wrapped() {
|
|
10038
|
+
const props = {
|
|
10039
|
+
params: useParams(),
|
|
10040
|
+
loaderData: useLoaderData(),
|
|
10041
|
+
actionData: useActionData()
|
|
10042
|
+
};
|
|
10043
|
+
return React13.createElement(HydrateFallback, props);
|
|
10044
|
+
};
|
|
10045
|
+
}
|
|
10046
|
+
function withErrorBoundaryProps(ErrorBoundary) {
|
|
10047
|
+
return function Wrapped() {
|
|
10048
|
+
const props = {
|
|
10049
|
+
params: useParams(),
|
|
10050
|
+
loaderData: useLoaderData(),
|
|
10051
|
+
actionData: useActionData(),
|
|
10052
|
+
error: useRouteError()
|
|
10053
|
+
};
|
|
10054
|
+
return React13.createElement(ErrorBoundary, props);
|
|
10055
|
+
};
|
|
10056
|
+
}
|
|
9987
10057
|
function processRoutes(routes, manifest, routeModules, parentId) {
|
|
9988
10058
|
return routes.map((route) => {
|
|
9989
10059
|
if (!route.id) {
|
|
@@ -9995,9 +10065,9 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9995
10065
|
id: route.id,
|
|
9996
10066
|
path: route.path,
|
|
9997
10067
|
index: route.index,
|
|
9998
|
-
Component: route.Component,
|
|
9999
|
-
HydrateFallback: route.HydrateFallback,
|
|
10000
|
-
ErrorBoundary: route.ErrorBoundary,
|
|
10068
|
+
Component: route.Component ? withComponentProps(route.Component) : void 0,
|
|
10069
|
+
HydrateFallback: route.HydrateFallback ? withHydrateFallbackProps(route.HydrateFallback) : void 0,
|
|
10070
|
+
ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
|
|
10001
10071
|
action: route.action,
|
|
10002
10072
|
loader: route.loader,
|
|
10003
10073
|
handle: route.handle,
|
|
@@ -10026,8 +10096,8 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
10026
10096
|
};
|
|
10027
10097
|
manifest.routes[newRoute.id] = entryRoute;
|
|
10028
10098
|
routeModules[route.id] = {
|
|
10029
|
-
default:
|
|
10030
|
-
ErrorBoundary:
|
|
10099
|
+
default: newRoute.Component || Outlet,
|
|
10100
|
+
ErrorBoundary: newRoute.ErrorBoundary || void 0,
|
|
10031
10101
|
handle: route.handle,
|
|
10032
10102
|
links: route.links,
|
|
10033
10103
|
meta: route.meta,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-b7b187661
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
useSearchParams,
|
|
126
126
|
useSubmit,
|
|
127
127
|
useViewTransitionState
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-2FQIWOOW.mjs";
|
|
129
129
|
export {
|
|
130
130
|
Await,
|
|
131
131
|
BrowserRouter,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { R as Register } from '../../register-e9PGCFx1.mjs';
|
|
2
|
-
import { aV as Normalize, aW as ServerDataFrom, aX as ClientDataFrom, aY as Func, aE as LinkDescriptor, E as Equal, L as Location, aB as MetaDescriptor, aZ as unstable_MiddlewareNextFunction, ac as unstable_RouterContextProvider,
|
|
2
|
+
import { aV as Normalize, aW as ServerDataFrom, aX as ClientDataFrom, aY as Func, aE as LinkDescriptor, E as Equal, L as Location, aB as MetaDescriptor, aZ as unstable_MiddlewareNextFunction, ac as unstable_RouterContextProvider, r as MiddlewareEnabled, s as AppLoadContext, a_ as Pretty } from '../../route-data-Wlht-qYx.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type AnyRoutes = Record<string, {
|
|
@@ -36,7 +36,9 @@ type GetChildren<Id extends RouteId> = _GetChildren<Id> extends [] ? [] : Exclud
|
|
|
36
36
|
type GetBranch<Id extends RouteId> = [
|
|
37
37
|
...GetParents<Id>,
|
|
38
38
|
Id,
|
|
39
|
-
...
|
|
39
|
+
...(RoutesPre[Id] extends {
|
|
40
|
+
path: undefined;
|
|
41
|
+
} ? GetChildren<Id> : _GetChildren<Id>)
|
|
40
42
|
];
|
|
41
43
|
type Branches = {
|
|
42
44
|
[Id in RouteId]: GetBranch<Id>;
|