react-router 0.0.0-experimental-e41ede670 → 0.0.0-experimental-4d16b23b6
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/CHANGELOG.md +10 -0
- package/dist/development/{chunk-H3OBLXFX.mjs → chunk-ZEZAGTYN.mjs} +300 -558
- package/dist/development/dom-export.d.mts +3 -13
- package/dist/development/dom-export.d.ts +3 -13
- package/dist/development/dom-export.js +38 -205
- package/dist/development/dom-export.mjs +6 -9
- package/dist/{production/fog-of-war-Bt7PejVF.d.ts → development/fog-of-war-CcF9dOvO.d.ts} +8 -87
- package/dist/development/{fog-of-war-Bt7PejVF.d.ts → fog-of-war-D5Q4Ix4U.d.mts} +8 -87
- package/dist/development/index.d.mts +11 -10
- package/dist/development/index.d.ts +11 -10
- package/dist/development/index.js +300 -558
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +2 -6
- package/dist/development/lib/types/route-module.d.ts +2 -6
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-C96IyGKo.d.ts → route-data-JFOfNyPS.d.mts} +15 -37
- package/dist/{production/route-data-C96IyGKo.d.mts → development/route-data-JFOfNyPS.d.ts} +15 -37
- package/dist/production/{chunk-YBZNESR7.mjs → chunk-HMMHPJ7W.mjs} +300 -558
- package/dist/production/dom-export.d.mts +3 -13
- package/dist/production/dom-export.d.ts +3 -13
- package/dist/production/dom-export.js +38 -205
- package/dist/production/dom-export.mjs +6 -9
- package/dist/{development/fog-of-war-Dz4n-TU-.d.mts → production/fog-of-war-CcF9dOvO.d.ts} +8 -87
- package/dist/production/{fog-of-war-Dz4n-TU-.d.mts → fog-of-war-D5Q4Ix4U.d.mts} +8 -87
- package/dist/production/index.d.mts +11 -10
- package/dist/production/index.d.ts +11 -10
- package/dist/production/index.js +300 -558
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +2 -6
- package/dist/production/lib/types/route-module.d.ts +2 -6
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-C96IyGKo.d.ts → route-data-JFOfNyPS.d.mts} +15 -37
- package/dist/{development/route-data-C96IyGKo.d.mts → production/route-data-JFOfNyPS.d.ts} +15 -37
- package/package.json +5 -11
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-D5Q4Ix4U.mjs';
|
|
3
|
+
import './route-data-JFOfNyPS.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
7
7
|
|
|
8
|
-
interface HydratedRouterProps {
|
|
9
|
-
/**
|
|
10
|
-
* Context object to passed through to `createBrowserRouter` and made available
|
|
11
|
-
* to `clientLoader`/`clientActon` functions
|
|
12
|
-
*/
|
|
13
|
-
context?: DefaultRouterContext;
|
|
14
|
-
}
|
|
15
8
|
/**
|
|
16
|
-
* Framework-mode router component to be used in `entry.client.tsx` to hydrate a
|
|
17
|
-
* router from a `ServerRouter`
|
|
18
|
-
*
|
|
19
9
|
* @category Router Components
|
|
20
10
|
*/
|
|
21
|
-
declare function HydratedRouter(
|
|
11
|
+
declare function HydratedRouter(): React.JSX.Element;
|
|
22
12
|
|
|
23
13
|
export { HydratedRouter, RouterProvider, type RouterProviderProps };
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-CcF9dOvO.js';
|
|
3
|
+
import './route-data-JFOfNyPS.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
7
7
|
|
|
8
|
-
interface HydratedRouterProps {
|
|
9
|
-
/**
|
|
10
|
-
* Context object to passed through to `createBrowserRouter` and made available
|
|
11
|
-
* to `clientLoader`/`clientActon` functions
|
|
12
|
-
*/
|
|
13
|
-
context?: DefaultRouterContext;
|
|
14
|
-
}
|
|
15
8
|
/**
|
|
16
|
-
* Framework-mode router component to be used in `entry.client.tsx` to hydrate a
|
|
17
|
-
* router from a `ServerRouter`
|
|
18
|
-
*
|
|
19
9
|
* @category Router Components
|
|
20
10
|
*/
|
|
21
|
-
declare function HydratedRouter(
|
|
11
|
+
declare function HydratedRouter(): React.JSX.Element;
|
|
22
12
|
|
|
23
13
|
export { HydratedRouter, RouterProvider, type RouterProviderProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-4d16b23b6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -679,10 +679,7 @@ var redirect = (url, init = 302) => {
|
|
|
679
679
|
}
|
|
680
680
|
let headers = new Headers(responseInit.headers);
|
|
681
681
|
headers.set("Location", url);
|
|
682
|
-
return new Response(null, {
|
|
683
|
-
...responseInit,
|
|
684
|
-
headers
|
|
685
|
-
});
|
|
682
|
+
return new Response(null, { ...responseInit, headers });
|
|
686
683
|
};
|
|
687
684
|
var ErrorResponseImpl = class {
|
|
688
685
|
constructor(status, statusText, data2, internal = false) {
|
|
@@ -767,7 +764,6 @@ function createRouter(init) {
|
|
|
767
764
|
);
|
|
768
765
|
let inFlightDataRoutes;
|
|
769
766
|
let basename = init.basename || "/";
|
|
770
|
-
let routerContext = typeof init.context !== "undefined" ? init.context : {};
|
|
771
767
|
let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;
|
|
772
768
|
let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;
|
|
773
769
|
let future = {
|
|
@@ -956,6 +952,11 @@ function createRouter(init) {
|
|
|
956
952
|
}
|
|
957
953
|
}
|
|
958
954
|
});
|
|
955
|
+
fetchersQueuedForDeletion.forEach((key) => {
|
|
956
|
+
if (!state.fetchers.has(key) && !fetchControllers.has(key)) {
|
|
957
|
+
unmountedFetchers.push(key);
|
|
958
|
+
}
|
|
959
|
+
});
|
|
959
960
|
[...subscribers].forEach(
|
|
960
961
|
(subscriber) => subscriber(state, {
|
|
961
962
|
deletedFetchers: unmountedFetchers,
|
|
@@ -1338,14 +1339,6 @@ function createRouter(init) {
|
|
|
1338
1339
|
null
|
|
1339
1340
|
);
|
|
1340
1341
|
result = results[actionMatch.route.id];
|
|
1341
|
-
if (!result) {
|
|
1342
|
-
for (let match of matches) {
|
|
1343
|
-
if (results[match.route.id]) {
|
|
1344
|
-
result = results[match.route.id];
|
|
1345
|
-
break;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
1342
|
if (request.signal.aborted) {
|
|
1350
1343
|
return { shortCircuited: true };
|
|
1351
1344
|
}
|
|
@@ -2007,13 +2000,13 @@ function createRouter(init) {
|
|
|
2007
2000
|
results = await callDataStrategyImpl(
|
|
2008
2001
|
dataStrategyImpl,
|
|
2009
2002
|
type,
|
|
2003
|
+
state2,
|
|
2010
2004
|
request,
|
|
2011
2005
|
matchesToLoad,
|
|
2012
2006
|
matches,
|
|
2013
2007
|
fetcherKey,
|
|
2014
2008
|
manifest,
|
|
2015
|
-
mapRouteProperties2
|
|
2016
|
-
routerContext
|
|
2009
|
+
mapRouteProperties2
|
|
2017
2010
|
);
|
|
2018
2011
|
} catch (e) {
|
|
2019
2012
|
matchesToLoad.forEach((m) => {
|
|
@@ -2804,124 +2797,20 @@ async function loadLazyRouteModule(route, mapRouteProperties2, manifest) {
|
|
|
2804
2797
|
lazy: void 0
|
|
2805
2798
|
});
|
|
2806
2799
|
}
|
|
2807
|
-
async function defaultDataStrategy(
|
|
2808
|
-
let matchesToLoad = args.matches.filter((m) => m.shouldLoad);
|
|
2809
|
-
let lastIndex = args.matches.length - 1;
|
|
2810
|
-
for (let i = lastIndex; i >= 0; i--) {
|
|
2811
|
-
if (args.matches[i].shouldLoad) {
|
|
2812
|
-
lastIndex = i;
|
|
2813
|
-
break;
|
|
2814
|
-
}
|
|
2815
|
-
}
|
|
2816
|
-
let results = await runMiddlewarePipeline(
|
|
2817
|
-
args,
|
|
2818
|
-
lastIndex,
|
|
2819
|
-
false,
|
|
2820
|
-
async (keyedResults) => {
|
|
2821
|
-
let results2 = await Promise.all(matchesToLoad.map((m) => m.resolve()));
|
|
2822
|
-
results2.forEach((result, i) => {
|
|
2823
|
-
keyedResults[matchesToLoad[i].route.id] = result;
|
|
2824
|
-
});
|
|
2825
|
-
}
|
|
2826
|
-
);
|
|
2827
|
-
return results;
|
|
2828
|
-
}
|
|
2829
|
-
async function runMiddlewarePipeline({
|
|
2830
|
-
request,
|
|
2831
|
-
params,
|
|
2832
|
-
context,
|
|
2800
|
+
async function defaultDataStrategy({
|
|
2833
2801
|
matches
|
|
2834
|
-
}
|
|
2835
|
-
let
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
0,
|
|
2842
|
-
{ request, params, context },
|
|
2843
|
-
keyedResults,
|
|
2844
|
-
propagateResult,
|
|
2845
|
-
handler
|
|
2846
|
-
);
|
|
2847
|
-
return propagateResult ? result : keyedResults;
|
|
2848
|
-
} catch (e) {
|
|
2849
|
-
if (!(e instanceof MiddlewareError)) {
|
|
2850
|
-
throw e;
|
|
2851
|
-
}
|
|
2852
|
-
if (propagateResult && isResponse(e.error)) {
|
|
2853
|
-
throw e.error;
|
|
2854
|
-
}
|
|
2855
|
-
return {
|
|
2856
|
-
...keyedResults,
|
|
2857
|
-
[e.routeId]: { type: "error", result: e.error }
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
}
|
|
2861
|
-
var MiddlewareError = class {
|
|
2862
|
-
constructor(routeId, error) {
|
|
2863
|
-
this.routeId = routeId;
|
|
2864
|
-
this.error = error;
|
|
2865
|
-
}
|
|
2866
|
-
};
|
|
2867
|
-
async function callRouteMiddleware(middlewares, idx, args, keyedResults, propagateResult, handler) {
|
|
2868
|
-
let { request } = args;
|
|
2869
|
-
if (request.signal.aborted) {
|
|
2870
|
-
if (request.signal.reason) {
|
|
2871
|
-
throw request.signal.reason;
|
|
2872
|
-
}
|
|
2873
|
-
throw new Error(
|
|
2874
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
2875
|
-
);
|
|
2876
|
-
}
|
|
2877
|
-
let tuple = middlewares[idx];
|
|
2878
|
-
if (!tuple) {
|
|
2879
|
-
let result = await handler(keyedResults);
|
|
2880
|
-
return result;
|
|
2881
|
-
}
|
|
2882
|
-
let [routeId, middleware] = tuple;
|
|
2883
|
-
let nextCalled = false;
|
|
2884
|
-
let next = async () => {
|
|
2885
|
-
if (nextCalled) {
|
|
2886
|
-
throw new Error("You may only call `next()` once per middleware");
|
|
2887
|
-
}
|
|
2888
|
-
nextCalled = true;
|
|
2889
|
-
let result = await callRouteMiddleware(
|
|
2890
|
-
middlewares,
|
|
2891
|
-
idx + 1,
|
|
2892
|
-
args,
|
|
2893
|
-
keyedResults,
|
|
2894
|
-
propagateResult,
|
|
2895
|
-
handler
|
|
2896
|
-
);
|
|
2897
|
-
return propagateResult ? result : void 0;
|
|
2898
|
-
};
|
|
2899
|
-
try {
|
|
2900
|
-
let result = await middleware(args, next);
|
|
2901
|
-
if (!nextCalled) {
|
|
2902
|
-
result = await next();
|
|
2903
|
-
}
|
|
2904
|
-
return result;
|
|
2905
|
-
} catch (e) {
|
|
2906
|
-
if (e instanceof MiddlewareError) {
|
|
2907
|
-
throw e;
|
|
2908
|
-
}
|
|
2909
|
-
throw new MiddlewareError(routeId, e);
|
|
2910
|
-
}
|
|
2802
|
+
}) {
|
|
2803
|
+
let matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
2804
|
+
let results = await Promise.all(matchesToLoad.map((m) => m.resolve()));
|
|
2805
|
+
return results.reduce(
|
|
2806
|
+
(acc, result, i) => Object.assign(acc, { [matchesToLoad[i].route.id]: result }),
|
|
2807
|
+
{}
|
|
2808
|
+
);
|
|
2911
2809
|
}
|
|
2912
|
-
async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2,
|
|
2810
|
+
async function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, requestContext) {
|
|
2913
2811
|
let loadRouteDefinitionsPromises = matches.map(
|
|
2914
2812
|
(m) => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties2, manifest) : void 0
|
|
2915
2813
|
);
|
|
2916
|
-
let lazyMiddlewarePromises = matches.map(
|
|
2917
|
-
(m, i) => m.route.lazy && !("middleware" in m.route) ? (
|
|
2918
|
-
// Swallow the error here, let it bubble up from resolve()
|
|
2919
|
-
loadRouteDefinitionsPromises[i].catch((e) => e)
|
|
2920
|
-
) : null
|
|
2921
|
-
).filter((p) => p != null);
|
|
2922
|
-
if (lazyMiddlewarePromises.length > 0) {
|
|
2923
|
-
await Promise.all(lazyMiddlewarePromises);
|
|
2924
|
-
}
|
|
2925
2814
|
let dsMatches = matches.map((match, i) => {
|
|
2926
2815
|
let loadRoutePromise = loadRouteDefinitionsPromises[i];
|
|
2927
2816
|
let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
|
|
@@ -2935,7 +2824,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
|
|
|
2935
2824
|
match,
|
|
2936
2825
|
loadRoutePromise,
|
|
2937
2826
|
handlerOverride,
|
|
2938
|
-
|
|
2827
|
+
requestContext
|
|
2939
2828
|
) : Promise.resolve({ type: "data" /* data */, result: void 0 });
|
|
2940
2829
|
};
|
|
2941
2830
|
return {
|
|
@@ -2949,7 +2838,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
|
|
|
2949
2838
|
request,
|
|
2950
2839
|
params: matches[0].params,
|
|
2951
2840
|
fetcherKey,
|
|
2952
|
-
context:
|
|
2841
|
+
context: requestContext
|
|
2953
2842
|
});
|
|
2954
2843
|
try {
|
|
2955
2844
|
await Promise.all(loadRouteDefinitionsPromises);
|
|
@@ -2957,7 +2846,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
|
|
|
2957
2846
|
}
|
|
2958
2847
|
return results;
|
|
2959
2848
|
}
|
|
2960
|
-
async function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride,
|
|
2849
|
+
async function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {
|
|
2961
2850
|
let result;
|
|
2962
2851
|
let onReject;
|
|
2963
2852
|
let runHandler = (handler) => {
|
|
@@ -2977,7 +2866,7 @@ async function callLoaderOrAction(type, request, match, loadRoutePromise, handle
|
|
|
2977
2866
|
{
|
|
2978
2867
|
request,
|
|
2979
2868
|
params: match.params,
|
|
2980
|
-
context:
|
|
2869
|
+
context: staticContext
|
|
2981
2870
|
},
|
|
2982
2871
|
...ctx !== void 0 ? [ctx] : []
|
|
2983
2872
|
);
|
|
@@ -4066,12 +3955,12 @@ function RouterProvider({
|
|
|
4066
3955
|
let fetcherData = React3.useRef(/* @__PURE__ */ new Map());
|
|
4067
3956
|
let setState = React3.useCallback(
|
|
4068
3957
|
(newState, { deletedFetchers, flushSync: flushSync2, viewTransitionOpts }) => {
|
|
4069
|
-
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
4070
3958
|
newState.fetchers.forEach((fetcher, key) => {
|
|
4071
3959
|
if (fetcher.data !== void 0) {
|
|
4072
3960
|
fetcherData.current.set(key, fetcher.data);
|
|
4073
3961
|
}
|
|
4074
3962
|
});
|
|
3963
|
+
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
4075
3964
|
warnOnce(
|
|
4076
3965
|
flushSync2 === false || reactDomFlushSyncImpl != null,
|
|
4077
3966
|
'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.'
|
|
@@ -4417,54 +4306,20 @@ async function createRequestInit(request) {
|
|
|
4417
4306
|
// lib/dom/ssr/single-fetch.tsx
|
|
4418
4307
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
4419
4308
|
function getSingleFetchDataStrategy(manifest, routeModules, getRouter) {
|
|
4420
|
-
return async (
|
|
4421
|
-
let { request, matches, fetcherKey } = args;
|
|
4309
|
+
return async ({ request, matches, fetcherKey }) => {
|
|
4422
4310
|
if (request.method !== "GET") {
|
|
4423
|
-
return
|
|
4424
|
-
args,
|
|
4425
|
-
matches.findIndex((m) => m.shouldLoad),
|
|
4426
|
-
false,
|
|
4427
|
-
async (keyedResults) => {
|
|
4428
|
-
let results = await singleFetchActionStrategy(request, matches);
|
|
4429
|
-
Object.assign(keyedResults, results);
|
|
4430
|
-
}
|
|
4431
|
-
);
|
|
4311
|
+
return singleFetchActionStrategy(request, matches);
|
|
4432
4312
|
}
|
|
4433
4313
|
if (fetcherKey) {
|
|
4434
|
-
return
|
|
4435
|
-
args,
|
|
4436
|
-
matches.findIndex((m) => m.shouldLoad),
|
|
4437
|
-
false,
|
|
4438
|
-
async (keyedResults) => {
|
|
4439
|
-
let results = await singleFetchLoaderFetcherStrategy(
|
|
4440
|
-
request,
|
|
4441
|
-
matches
|
|
4442
|
-
);
|
|
4443
|
-
Object.assign(keyedResults, results);
|
|
4444
|
-
}
|
|
4445
|
-
);
|
|
4314
|
+
return singleFetchLoaderFetcherStrategy(request, matches);
|
|
4446
4315
|
}
|
|
4447
|
-
|
|
4316
|
+
return singleFetchLoaderNavigationStrategy(
|
|
4448
4317
|
manifest,
|
|
4449
4318
|
routeModules,
|
|
4450
4319
|
getRouter(),
|
|
4320
|
+
request,
|
|
4451
4321
|
matches
|
|
4452
4322
|
);
|
|
4453
|
-
return runMiddlewarePipeline(
|
|
4454
|
-
args,
|
|
4455
|
-
lowestLoadingIndex,
|
|
4456
|
-
false,
|
|
4457
|
-
async (keyedResults) => {
|
|
4458
|
-
let results = await singleFetchLoaderNavigationStrategy(
|
|
4459
|
-
manifest,
|
|
4460
|
-
routeModules,
|
|
4461
|
-
getRouter(),
|
|
4462
|
-
request,
|
|
4463
|
-
matches
|
|
4464
|
-
);
|
|
4465
|
-
Object.assign(keyedResults, results);
|
|
4466
|
-
}
|
|
4467
|
-
);
|
|
4468
4323
|
};
|
|
4469
4324
|
}
|
|
4470
4325
|
async function singleFetchActionStrategy(request, matches) {
|
|
@@ -4494,20 +4349,6 @@ async function singleFetchActionStrategy(request, matches) {
|
|
|
4494
4349
|
}
|
|
4495
4350
|
};
|
|
4496
4351
|
}
|
|
4497
|
-
function isOptedOut(manifestRoute, routeModule, match, router2) {
|
|
4498
|
-
return match.route.id in router2.state.loaderData && manifestRoute && manifestRoute.hasLoader && routeModule && routeModule.shouldRevalidate;
|
|
4499
|
-
}
|
|
4500
|
-
function getLowestLoadingIndex(manifest, routeModules, router2, matches) {
|
|
4501
|
-
let tailIdx = [...matches].reverse().findIndex(
|
|
4502
|
-
(m) => m.shouldLoad || !isOptedOut(
|
|
4503
|
-
manifest.routes[m.route.id],
|
|
4504
|
-
routeModules[m.route.id],
|
|
4505
|
-
m,
|
|
4506
|
-
router2
|
|
4507
|
-
)
|
|
4508
|
-
);
|
|
4509
|
-
return tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
|
|
4510
|
-
}
|
|
4511
4352
|
async function singleFetchLoaderNavigationStrategy(manifest, routeModules, router2, request, matches) {
|
|
4512
4353
|
let routesParams = /* @__PURE__ */ new Set();
|
|
4513
4354
|
let foundOptOutRoute = false;
|
|
@@ -4526,7 +4367,7 @@ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, route
|
|
|
4526
4367
|
if (!router2.state.initialized) {
|
|
4527
4368
|
return;
|
|
4528
4369
|
}
|
|
4529
|
-
if (
|
|
4370
|
+
if (m.route.id in router2.state.loaderData && manifestRoute && manifestRoute.hasLoader && routeModules[m.route.id]?.shouldRevalidate) {
|
|
4530
4371
|
foundOptOutRoute = true;
|
|
4531
4372
|
return;
|
|
4532
4373
|
}
|
|
@@ -4702,7 +4543,7 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
4702
4543
|
if (result.replace) {
|
|
4703
4544
|
headers["X-Remix-Replace"] = "yes";
|
|
4704
4545
|
}
|
|
4705
|
-
|
|
4546
|
+
throw redirect(result.redirect, { status: result.status, headers });
|
|
4706
4547
|
} else if ("data" in result) {
|
|
4707
4548
|
return result.data;
|
|
4708
4549
|
} else {
|
|
@@ -4963,7 +4804,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4963
4804
|
Object.assign(dataRoute, {
|
|
4964
4805
|
...dataRoute,
|
|
4965
4806
|
...getRouteComponents(route, routeModule, isSpaMode),
|
|
4966
|
-
middleware: routeModule.clientMiddleware,
|
|
4967
4807
|
handle: routeModule.handle,
|
|
4968
4808
|
shouldRevalidate: getShouldRevalidateFunction(
|
|
4969
4809
|
routeModule,
|
|
@@ -4976,7 +4816,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4976
4816
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
4977
4817
|
let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
|
|
4978
4818
|
let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
|
|
4979
|
-
dataRoute.loader = async ({ request, params
|
|
4819
|
+
dataRoute.loader = async ({ request, params }, singleFetch) => {
|
|
4980
4820
|
try {
|
|
4981
4821
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
4982
4822
|
invariant2(
|
|
@@ -4990,7 +4830,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4990
4830
|
return routeModule.clientLoader({
|
|
4991
4831
|
request,
|
|
4992
4832
|
params,
|
|
4993
|
-
context,
|
|
4994
4833
|
async serverLoader() {
|
|
4995
4834
|
preventInvalidServerHandlerCall("loader", route, isSpaMode);
|
|
4996
4835
|
if (isHydrationRequest) {
|
|
@@ -5015,7 +4854,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
5015
4854
|
routeModule,
|
|
5016
4855
|
isSpaMode
|
|
5017
4856
|
);
|
|
5018
|
-
dataRoute.action = ({ request, params
|
|
4857
|
+
dataRoute.action = ({ request, params }, singleFetch) => {
|
|
5019
4858
|
return prefetchStylesAndCallHandler(async () => {
|
|
5020
4859
|
invariant2(
|
|
5021
4860
|
routeModule,
|
|
@@ -5030,7 +4869,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
5030
4869
|
return routeModule.clientAction({
|
|
5031
4870
|
request,
|
|
5032
4871
|
params,
|
|
5033
|
-
context,
|
|
5034
4872
|
async serverAction() {
|
|
5035
4873
|
preventInvalidServerHandlerCall("action", route, isSpaMode);
|
|
5036
4874
|
return fetchServerAction(singleFetch);
|
|
@@ -5040,13 +4878,13 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
5040
4878
|
};
|
|
5041
4879
|
} else {
|
|
5042
4880
|
if (!route.hasClientLoader) {
|
|
5043
|
-
dataRoute.loader = (
|
|
4881
|
+
dataRoute.loader = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
5044
4882
|
if (isSpaMode) return Promise.resolve(null);
|
|
5045
4883
|
return fetchServerLoader(singleFetch);
|
|
5046
4884
|
});
|
|
5047
4885
|
}
|
|
5048
4886
|
if (!route.hasClientAction) {
|
|
5049
|
-
dataRoute.action = (
|
|
4887
|
+
dataRoute.action = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
5050
4888
|
if (isSpaMode) {
|
|
5051
4889
|
throw noActionDefinedError("clientAction", route.id);
|
|
5052
4890
|
}
|
|
@@ -5082,7 +4920,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
5082
4920
|
return {
|
|
5083
4921
|
...lazyRoute.loader ? { loader: lazyRoute.loader } : {},
|
|
5084
4922
|
...lazyRoute.action ? { action: lazyRoute.action } : {},
|
|
5085
|
-
middleware: mod.clientMiddleware,
|
|
5086
4923
|
hasErrorBoundary: lazyRoute.hasErrorBoundary,
|
|
5087
4924
|
shouldRevalidate: getShouldRevalidateFunction(
|
|
5088
4925
|
lazyRoute,
|
|
@@ -5140,7 +4977,6 @@ async function loadRouteModuleWithBlockingLinks(route, routeModules) {
|
|
|
5140
4977
|
return {
|
|
5141
4978
|
Component: getRouteModuleComponent(routeModule),
|
|
5142
4979
|
ErrorBoundary: routeModule.ErrorBoundary,
|
|
5143
|
-
clientMiddleware: routeModule.clientMiddleware,
|
|
5144
4980
|
clientAction: routeModule.clientAction,
|
|
5145
4981
|
clientLoader: routeModule.clientLoader,
|
|
5146
4982
|
handle: routeModule.handle,
|
|
@@ -5518,9 +5354,7 @@ function initSsrInfo() {
|
|
|
5518
5354
|
};
|
|
5519
5355
|
}
|
|
5520
5356
|
}
|
|
5521
|
-
function createHydratedRouter({
|
|
5522
|
-
context
|
|
5523
|
-
}) {
|
|
5357
|
+
function createHydratedRouter() {
|
|
5524
5358
|
initSsrInfo();
|
|
5525
5359
|
if (!ssrInfo) {
|
|
5526
5360
|
throw new Error(
|
|
@@ -5586,10 +5420,9 @@ function createHydratedRouter({
|
|
|
5586
5420
|
routes,
|
|
5587
5421
|
history: createBrowserHistory(),
|
|
5588
5422
|
basename: ssrInfo.context.basename,
|
|
5589
|
-
context,
|
|
5590
5423
|
hydrationData,
|
|
5591
5424
|
mapRouteProperties,
|
|
5592
|
-
dataStrategy:
|
|
5425
|
+
dataStrategy: getSingleFetchDataStrategy(
|
|
5593
5426
|
ssrInfo.manifest,
|
|
5594
5427
|
ssrInfo.routeModules,
|
|
5595
5428
|
() => router2
|
|
@@ -5611,9 +5444,9 @@ function createHydratedRouter({
|
|
|
5611
5444
|
window.__reactRouterDataRouter = router2;
|
|
5612
5445
|
return router2;
|
|
5613
5446
|
}
|
|
5614
|
-
function HydratedRouter(
|
|
5447
|
+
function HydratedRouter() {
|
|
5615
5448
|
if (!router) {
|
|
5616
|
-
router = createHydratedRouter(
|
|
5449
|
+
router = createHydratedRouter();
|
|
5617
5450
|
}
|
|
5618
5451
|
let [criticalCss, setCriticalCss] = React11.useState(
|
|
5619
5452
|
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-4d16b23b6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
matchRoutes,
|
|
26
26
|
shouldHydrateRouteLoader,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZEZAGTYN.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -50,9 +50,7 @@ function initSsrInfo() {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
function createHydratedRouter({
|
|
54
|
-
context
|
|
55
|
-
}) {
|
|
53
|
+
function createHydratedRouter() {
|
|
56
54
|
initSsrInfo();
|
|
57
55
|
if (!ssrInfo) {
|
|
58
56
|
throw new Error(
|
|
@@ -118,10 +116,9 @@ function createHydratedRouter({
|
|
|
118
116
|
routes,
|
|
119
117
|
history: createBrowserHistory(),
|
|
120
118
|
basename: ssrInfo.context.basename,
|
|
121
|
-
context,
|
|
122
119
|
hydrationData,
|
|
123
120
|
mapRouteProperties,
|
|
124
|
-
dataStrategy:
|
|
121
|
+
dataStrategy: getSingleFetchDataStrategy(
|
|
125
122
|
ssrInfo.manifest,
|
|
126
123
|
ssrInfo.routeModules,
|
|
127
124
|
() => router2
|
|
@@ -143,9 +140,9 @@ function createHydratedRouter({
|
|
|
143
140
|
window.__reactRouterDataRouter = router2;
|
|
144
141
|
return router2;
|
|
145
142
|
}
|
|
146
|
-
function HydratedRouter(
|
|
143
|
+
function HydratedRouter() {
|
|
147
144
|
if (!router) {
|
|
148
|
-
router = createHydratedRouter(
|
|
145
|
+
router = createHydratedRouter();
|
|
149
146
|
}
|
|
150
147
|
let [criticalCss, setCriticalCss] = React2.useState(
|
|
151
148
|
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
|