react-router 0.0.0-experimental-3d7dcee → 0.0.0-experimental-426e5caec
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 +39 -2
- package/dist/development/{chunk-WJ2QP6HN.mjs → chunk-5HELVQDL.mjs} +179 -249
- package/dist/development/{chunk-S2WJDCRE.js → chunk-KCPD675I.js} +173 -243
- package/dist/{production/chunk-NIW37A6Q.js → development/chunk-KPVSYEOF.js} +135 -135
- package/dist/development/{chunk-QMIAKNRH.mjs → chunk-ZOYSFAC5.mjs} +56 -102
- package/dist/{production/context-DnZM5brG.d.mts → development/context-EwD9faH7.d.mts} +34 -33
- package/dist/development/dom-export.d.mts +3 -3
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +7 -7
- package/dist/development/dom-export.mjs +7 -7
- package/dist/development/{index-react-server-client-zr5eNeut.d.ts → index-react-server-client-CjrUmqhw.d.ts} +12 -12
- package/dist/{production/index-react-server-client-9rHNv-U3.d.mts → development/index-react-server-client-DDdP8ud2.d.mts} +13 -13
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +76 -38
- package/dist/development/index-react-server.d.ts +76 -38
- package/dist/development/index-react-server.js +116 -112
- package/dist/development/index-react-server.mjs +114 -111
- package/dist/development/index.d.mts +53 -15
- package/dist/development/index.d.ts +51 -13
- package/dist/development/index.js +138 -184
- package/dist/development/index.mjs +7 -7
- package/dist/development/lib/types/internal.d.mts +11 -8
- package/dist/development/lib/types/internal.d.ts +10 -7
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-C24VEkoE.d.mts → route-data-CAnRKu1U.d.mts} +14 -14
- package/dist/development/{routeModules-FY5IBiA_.d.ts → routeModules-CQWjJ9NX.d.ts} +46 -45
- package/dist/production/{chunk-2BFZ6QQU.mjs → chunk-5W7O3ZZ2.mjs} +179 -249
- package/dist/production/{chunk-OFC37UQM.mjs → chunk-DZS627TW.mjs} +56 -102
- package/dist/production/{chunk-7CWVKQLP.js → chunk-NLCKEFES.js} +173 -243
- package/dist/{development/chunk-LSB26UC6.js → production/chunk-TC5SCO6O.js} +135 -135
- package/dist/{development/context-DnZM5brG.d.mts → production/context-EwD9faH7.d.mts} +34 -33
- package/dist/production/dom-export.d.mts +3 -3
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +7 -7
- package/dist/production/dom-export.mjs +7 -7
- package/dist/production/{index-react-server-client-zr5eNeut.d.ts → index-react-server-client-CjrUmqhw.d.ts} +12 -12
- package/dist/{development/index-react-server-client-9rHNv-U3.d.mts → production/index-react-server-client-DDdP8ud2.d.mts} +13 -13
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +76 -38
- package/dist/production/index-react-server.d.ts +76 -38
- package/dist/production/index-react-server.js +116 -112
- package/dist/production/index-react-server.mjs +114 -111
- package/dist/production/index.d.mts +53 -15
- package/dist/production/index.d.ts +51 -13
- package/dist/production/index.js +138 -184
- package/dist/production/index.mjs +7 -7
- package/dist/production/lib/types/internal.d.mts +11 -8
- package/dist/production/lib/types/internal.d.ts +10 -7
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-C24VEkoE.d.mts → route-data-CAnRKu1U.d.mts} +14 -14
- package/dist/production/{routeModules-FY5IBiA_.d.ts → routeModules-CQWjJ9NX.d.ts} +46 -45
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export { Await, BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta
|
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v0.0.0-experimental-
|
|
9
|
+
* react-router v0.0.0-experimental-426e5caec
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -87,13 +87,13 @@ function parsePath(path) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// lib/router/utils.ts
|
|
90
|
-
function
|
|
90
|
+
function createContext(defaultValue) {
|
|
91
91
|
return { defaultValue };
|
|
92
92
|
}
|
|
93
93
|
var _map;
|
|
94
|
-
var
|
|
94
|
+
var RouterContextProvider = class {
|
|
95
95
|
/**
|
|
96
|
-
* Create a new `
|
|
96
|
+
* Create a new `RouterContextProvider` instance
|
|
97
97
|
* @param init An optional initial context map to populate the provider with
|
|
98
98
|
*/
|
|
99
99
|
constructor(init) {
|
|
@@ -153,7 +153,7 @@ var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
|
|
|
153
153
|
"path",
|
|
154
154
|
"id",
|
|
155
155
|
"index",
|
|
156
|
-
"
|
|
156
|
+
"middleware",
|
|
157
157
|
"children"
|
|
158
158
|
]);
|
|
159
159
|
function isUnsupportedLazyRouteFunctionKey(key) {
|
|
@@ -674,13 +674,13 @@ function createStaticHandler(routes, opts) {
|
|
|
674
674
|
skipLoaderErrorBubbling,
|
|
675
675
|
skipRevalidation,
|
|
676
676
|
dataStrategy,
|
|
677
|
-
|
|
677
|
+
generateMiddlewareResponse
|
|
678
678
|
} = {}) {
|
|
679
679
|
let url = new URL(request.url);
|
|
680
680
|
let method = request.method;
|
|
681
681
|
let location = createLocation("", createPath(url), null, "default");
|
|
682
682
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
683
|
-
requestContext = requestContext != null ? requestContext : new
|
|
683
|
+
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
684
684
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
685
685
|
let error = getInternalRouterError(405, { method });
|
|
686
686
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -718,8 +718,8 @@ function createStaticHandler(routes, opts) {
|
|
|
718
718
|
}
|
|
719
719
|
if (generateMiddlewareResponse) {
|
|
720
720
|
invariant(
|
|
721
|
-
requestContext instanceof
|
|
722
|
-
"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `
|
|
721
|
+
requestContext instanceof RouterContextProvider,
|
|
722
|
+
"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
|
|
723
723
|
);
|
|
724
724
|
try {
|
|
725
725
|
await loadLazyMiddlewareForMatches(
|
|
@@ -739,7 +739,7 @@ function createStaticHandler(routes, opts) {
|
|
|
739
739
|
},
|
|
740
740
|
async () => {
|
|
741
741
|
let res = await generateMiddlewareResponse(
|
|
742
|
-
async (revalidationRequest) => {
|
|
742
|
+
async (revalidationRequest, opts2 = {}) => {
|
|
743
743
|
let result2 = await queryImpl(
|
|
744
744
|
revalidationRequest,
|
|
745
745
|
location,
|
|
@@ -748,7 +748,7 @@ function createStaticHandler(routes, opts) {
|
|
|
748
748
|
dataStrategy || null,
|
|
749
749
|
skipLoaderErrorBubbling === true,
|
|
750
750
|
null,
|
|
751
|
-
filterMatchesToLoad
|
|
751
|
+
"filterMatchesToLoad" in opts2 ? opts2.filterMatchesToLoad ?? null : null,
|
|
752
752
|
skipRevalidation === true
|
|
753
753
|
);
|
|
754
754
|
if (isResponse(result2)) {
|
|
@@ -761,9 +761,23 @@ function createStaticHandler(routes, opts) {
|
|
|
761
761
|
return res;
|
|
762
762
|
},
|
|
763
763
|
async (error, routeId) => {
|
|
764
|
-
if (
|
|
764
|
+
if (isRedirectResponse(error)) {
|
|
765
765
|
return error;
|
|
766
766
|
}
|
|
767
|
+
if (isResponse(error)) {
|
|
768
|
+
try {
|
|
769
|
+
error = new ErrorResponseImpl(
|
|
770
|
+
error.status,
|
|
771
|
+
error.statusText,
|
|
772
|
+
await parseResponseBody(error)
|
|
773
|
+
);
|
|
774
|
+
} catch (e) {
|
|
775
|
+
error = e;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (isDataWithResponseInit(error)) {
|
|
779
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
780
|
+
}
|
|
767
781
|
if (renderedStaticContext) {
|
|
768
782
|
if (routeId in renderedStaticContext.loaderData) {
|
|
769
783
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -832,13 +846,13 @@ function createStaticHandler(routes, opts) {
|
|
|
832
846
|
routeId,
|
|
833
847
|
requestContext,
|
|
834
848
|
dataStrategy,
|
|
835
|
-
|
|
849
|
+
generateMiddlewareResponse
|
|
836
850
|
} = {}) {
|
|
837
851
|
let url = new URL(request.url);
|
|
838
852
|
let method = request.method;
|
|
839
853
|
let location = createLocation("", createPath(url), null, "default");
|
|
840
854
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
841
|
-
requestContext = requestContext != null ? requestContext : new
|
|
855
|
+
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
842
856
|
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
|
843
857
|
throw getInternalRouterError(405, { method });
|
|
844
858
|
} else if (!matches) {
|
|
@@ -855,8 +869,8 @@ function createStaticHandler(routes, opts) {
|
|
|
855
869
|
}
|
|
856
870
|
if (generateMiddlewareResponse) {
|
|
857
871
|
invariant(
|
|
858
|
-
requestContext instanceof
|
|
859
|
-
"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `
|
|
872
|
+
requestContext instanceof RouterContextProvider,
|
|
873
|
+
"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
|
|
860
874
|
);
|
|
861
875
|
await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);
|
|
862
876
|
let response = await runServerMiddlewarePipeline(
|
|
@@ -889,8 +903,8 @@ function createStaticHandler(routes, opts) {
|
|
|
889
903
|
return res;
|
|
890
904
|
},
|
|
891
905
|
(error) => {
|
|
892
|
-
if (
|
|
893
|
-
return Promise.resolve(
|
|
906
|
+
if (isDataWithResponseInit(error)) {
|
|
907
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
894
908
|
}
|
|
895
909
|
if (isResponse(error)) {
|
|
896
910
|
return Promise.resolve(error);
|
|
@@ -1217,8 +1231,12 @@ function createStaticHandler(routes, opts) {
|
|
|
1217
1231
|
basename
|
|
1218
1232
|
);
|
|
1219
1233
|
}
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1234
|
+
if (isRouteRequest) {
|
|
1235
|
+
if (isResponse(result.result)) {
|
|
1236
|
+
throw result;
|
|
1237
|
+
} else if (isDataWithResponseInit(result.result)) {
|
|
1238
|
+
throw dataWithResponseInitToResponse(result.result);
|
|
1239
|
+
}
|
|
1222
1240
|
}
|
|
1223
1241
|
dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
|
|
1224
1242
|
})
|
|
@@ -1453,11 +1471,11 @@ function isNonNullable(value) {
|
|
|
1453
1471
|
}
|
|
1454
1472
|
function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties) {
|
|
1455
1473
|
let promises = matches.map(({ route }) => {
|
|
1456
|
-
if (typeof route.lazy !== "object" || !route.lazy.
|
|
1474
|
+
if (typeof route.lazy !== "object" || !route.lazy.middleware) {
|
|
1457
1475
|
return void 0;
|
|
1458
1476
|
}
|
|
1459
1477
|
return loadLazyRouteProperty({
|
|
1460
|
-
key: "
|
|
1478
|
+
key: "middleware",
|
|
1461
1479
|
route,
|
|
1462
1480
|
manifest,
|
|
1463
1481
|
mapRouteProperties
|
|
@@ -1474,31 +1492,37 @@ async function defaultDataStrategy(args) {
|
|
|
1474
1492
|
});
|
|
1475
1493
|
return keyedResults;
|
|
1476
1494
|
}
|
|
1477
|
-
|
|
1495
|
+
function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
1496
|
+
return runMiddlewarePipeline(
|
|
1497
|
+
args,
|
|
1498
|
+
handler,
|
|
1499
|
+
processResult,
|
|
1500
|
+
isResponse,
|
|
1501
|
+
errorHandler
|
|
1502
|
+
);
|
|
1503
|
+
function processResult(result) {
|
|
1504
|
+
return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
1478
1508
|
let { matches, request, params, context } = args;
|
|
1479
1509
|
let tuples = matches.flatMap(
|
|
1480
|
-
(m) => m.route.
|
|
1510
|
+
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1481
1511
|
);
|
|
1482
|
-
let result = await
|
|
1512
|
+
let result = await callRouteMiddleware(
|
|
1483
1513
|
{ request, params, context },
|
|
1484
1514
|
tuples,
|
|
1485
1515
|
handler,
|
|
1516
|
+
processResult,
|
|
1517
|
+
isResult,
|
|
1486
1518
|
errorHandler
|
|
1487
1519
|
);
|
|
1488
|
-
|
|
1489
|
-
return result;
|
|
1490
|
-
}
|
|
1491
|
-
invariant(false, `Expected a Response to be returned from route middleware`);
|
|
1520
|
+
return result;
|
|
1492
1521
|
}
|
|
1493
|
-
async function
|
|
1522
|
+
async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {
|
|
1494
1523
|
let { request } = args;
|
|
1495
1524
|
if (request.signal.aborted) {
|
|
1496
|
-
|
|
1497
|
-
throw request.signal.reason;
|
|
1498
|
-
}
|
|
1499
|
-
throw new Error(
|
|
1500
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
1501
|
-
);
|
|
1525
|
+
throw request.signal.reason ?? new Error(`Request aborted: ${request.method} ${request.url}`);
|
|
1502
1526
|
}
|
|
1503
1527
|
let tuple = middlewares[idx];
|
|
1504
1528
|
if (!tuple) {
|
|
@@ -1506,67 +1530,47 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1506
1530
|
return result;
|
|
1507
1531
|
}
|
|
1508
1532
|
let [routeId, middleware] = tuple;
|
|
1509
|
-
let
|
|
1510
|
-
let nextResult = void 0;
|
|
1533
|
+
let nextResult;
|
|
1511
1534
|
let next = async () => {
|
|
1512
|
-
if (
|
|
1535
|
+
if (nextResult) {
|
|
1513
1536
|
throw new Error("You may only call `next()` once per middleware");
|
|
1514
1537
|
}
|
|
1515
|
-
nextCalled = true;
|
|
1516
1538
|
try {
|
|
1517
|
-
let result = await
|
|
1539
|
+
let result = await callRouteMiddleware(
|
|
1518
1540
|
args,
|
|
1519
1541
|
middlewares,
|
|
1520
1542
|
handler,
|
|
1543
|
+
processResult,
|
|
1544
|
+
isResult,
|
|
1521
1545
|
errorHandler,
|
|
1522
1546
|
idx + 1
|
|
1523
1547
|
);
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
nextResult =
|
|
1528
|
-
return nextResult;
|
|
1529
|
-
} catch (e) {
|
|
1530
|
-
nextResult = await errorHandler(
|
|
1531
|
-
// Convert thrown data() values to ErrorResponses
|
|
1532
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1533
|
-
routeId
|
|
1534
|
-
);
|
|
1535
|
-
return nextResult;
|
|
1548
|
+
nextResult = { value: result };
|
|
1549
|
+
return nextResult.value;
|
|
1550
|
+
} catch (error) {
|
|
1551
|
+
nextResult = { value: await errorHandler(error, routeId, nextResult) };
|
|
1552
|
+
return nextResult.value;
|
|
1536
1553
|
}
|
|
1537
1554
|
};
|
|
1538
1555
|
try {
|
|
1539
|
-
let
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
params: args.params,
|
|
1543
|
-
context: args.context
|
|
1544
|
-
},
|
|
1545
|
-
next
|
|
1546
|
-
);
|
|
1547
|
-
if (isDataWithResponseInit(result)) {
|
|
1548
|
-
result = dataWithResponseInitToResponse(result);
|
|
1549
|
-
}
|
|
1550
|
-
if (nextCalled) {
|
|
1551
|
-
return typeof result === "undefined" ? nextResult : result;
|
|
1552
|
-
} else if (isResponse(result)) {
|
|
1556
|
+
let value = await middleware(args, next);
|
|
1557
|
+
let result = value != null ? processResult(value) : void 0;
|
|
1558
|
+
if (isResult(result)) {
|
|
1553
1559
|
return result;
|
|
1560
|
+
} else if (nextResult) {
|
|
1561
|
+
return result ?? nextResult.value;
|
|
1554
1562
|
} else {
|
|
1555
|
-
nextResult = await next();
|
|
1556
|
-
return nextResult;
|
|
1563
|
+
nextResult = { value: await next() };
|
|
1564
|
+
return nextResult.value;
|
|
1557
1565
|
}
|
|
1558
|
-
} catch (
|
|
1559
|
-
let response = await errorHandler(
|
|
1560
|
-
// Convert thrown data() values to ErrorResponses
|
|
1561
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1562
|
-
routeId
|
|
1563
|
-
);
|
|
1566
|
+
} catch (error) {
|
|
1567
|
+
let response = await errorHandler(error, routeId, nextResult);
|
|
1564
1568
|
return response;
|
|
1565
1569
|
}
|
|
1566
1570
|
}
|
|
1567
1571
|
function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {
|
|
1568
1572
|
let lazyMiddlewarePromise = loadLazyRouteProperty({
|
|
1569
|
-
key: "
|
|
1573
|
+
key: "middleware",
|
|
1570
1574
|
route: match.route,
|
|
1571
1575
|
manifest,
|
|
1572
1576
|
mapRouteProperties
|
|
@@ -1666,15 +1670,15 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1666
1670
|
context: scopedContext,
|
|
1667
1671
|
matches
|
|
1668
1672
|
};
|
|
1669
|
-
let
|
|
1673
|
+
let runClientMiddleware = () => {
|
|
1670
1674
|
throw new Error(
|
|
1671
|
-
"You cannot call `
|
|
1675
|
+
"You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`"
|
|
1672
1676
|
);
|
|
1673
1677
|
} ;
|
|
1674
1678
|
let results = await dataStrategyImpl({
|
|
1675
1679
|
...dataStrategyArgs,
|
|
1676
1680
|
fetcherKey,
|
|
1677
|
-
|
|
1681
|
+
runClientMiddleware
|
|
1678
1682
|
});
|
|
1679
1683
|
try {
|
|
1680
1684
|
await Promise.all(
|
|
@@ -1786,21 +1790,19 @@ async function callLoaderOrAction({
|
|
|
1786
1790
|
}
|
|
1787
1791
|
return result;
|
|
1788
1792
|
}
|
|
1793
|
+
async function parseResponseBody(response) {
|
|
1794
|
+
let contentType = response.headers.get("Content-Type");
|
|
1795
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1796
|
+
return response.body == null ? null : response.json();
|
|
1797
|
+
}
|
|
1798
|
+
return response.text();
|
|
1799
|
+
}
|
|
1789
1800
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
1790
1801
|
let { result, type } = dataStrategyResult;
|
|
1791
1802
|
if (isResponse(result)) {
|
|
1792
1803
|
let data2;
|
|
1793
1804
|
try {
|
|
1794
|
-
|
|
1795
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1796
|
-
if (result.body == null) {
|
|
1797
|
-
data2 = null;
|
|
1798
|
-
} else {
|
|
1799
|
-
data2 = await result.json();
|
|
1800
|
-
}
|
|
1801
|
-
} else {
|
|
1802
|
-
data2 = await result.text();
|
|
1803
|
-
}
|
|
1805
|
+
data2 = await parseResponseBody(result);
|
|
1804
1806
|
} catch (e) {
|
|
1805
1807
|
return { type: "error" /* error */, error: e };
|
|
1806
1808
|
}
|
|
@@ -2000,10 +2002,7 @@ function getInternalRouterError(status, {
|
|
|
2000
2002
|
);
|
|
2001
2003
|
}
|
|
2002
2004
|
function dataWithResponseInitToResponse(data2) {
|
|
2003
|
-
return
|
|
2004
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
2005
|
-
data2.init || void 0
|
|
2006
|
-
);
|
|
2005
|
+
return Response.json(data2.data, data2.init ?? void 0);
|
|
2007
2006
|
}
|
|
2008
2007
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
2009
2008
|
return new ErrorResponseImpl(
|
|
@@ -2012,15 +2011,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
2012
2011
|
data2.data
|
|
2013
2012
|
);
|
|
2014
2013
|
}
|
|
2015
|
-
function errorResponseToResponse(error) {
|
|
2016
|
-
return new Response(
|
|
2017
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
2018
|
-
{
|
|
2019
|
-
status: error.status,
|
|
2020
|
-
statusText: error.statusText
|
|
2021
|
-
}
|
|
2022
|
-
);
|
|
2023
|
-
}
|
|
2024
2014
|
function isDataStrategyResult(result) {
|
|
2025
2015
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
2026
2016
|
}
|
|
@@ -2322,9 +2312,13 @@ async function processServerAction(request, basename, decodeReply, loadServerAct
|
|
|
2322
2312
|
}
|
|
2323
2313
|
onError?.(error);
|
|
2324
2314
|
}
|
|
2315
|
+
let maybeFormData = actionArgs.length === 1 ? actionArgs[0] : actionArgs[1];
|
|
2316
|
+
let formData = maybeFormData && typeof maybeFormData === "object" && maybeFormData instanceof FormData ? maybeFormData : null;
|
|
2317
|
+
let skipRevalidation = formData?.has("$SKIP_REVALIDATION") ?? false;
|
|
2325
2318
|
return {
|
|
2326
2319
|
actionResult,
|
|
2327
|
-
revalidationRequest: getRevalidationRequest()
|
|
2320
|
+
revalidationRequest: getRevalidationRequest(),
|
|
2321
|
+
skipRevalidation
|
|
2328
2322
|
};
|
|
2329
2323
|
} else if (isFormRequest) {
|
|
2330
2324
|
const formData = await request.clone().formData();
|
|
@@ -2353,7 +2347,8 @@ async function processServerAction(request, basename, decodeReply, loadServerAct
|
|
|
2353
2347
|
}
|
|
2354
2348
|
return {
|
|
2355
2349
|
formState,
|
|
2356
|
-
revalidationRequest: getRevalidationRequest()
|
|
2350
|
+
revalidationRequest: getRevalidationRequest(),
|
|
2351
|
+
skipRevalidation: false
|
|
2357
2352
|
};
|
|
2358
2353
|
}
|
|
2359
2354
|
}
|
|
@@ -2366,7 +2361,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
|
|
2366
2361
|
let response = await staticHandler.queryRoute(request, {
|
|
2367
2362
|
routeId,
|
|
2368
2363
|
requestContext,
|
|
2369
|
-
async
|
|
2364
|
+
async generateMiddlewareResponse(queryRoute) {
|
|
2370
2365
|
try {
|
|
2371
2366
|
let response2 = await queryRoute(request);
|
|
2372
2367
|
return generateResourceResponse2(response2);
|
|
@@ -2427,9 +2422,10 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2427
2422
|
requestContext,
|
|
2428
2423
|
skipLoaderErrorBubbling: isDataRequest,
|
|
2429
2424
|
skipRevalidation: isSubmission,
|
|
2430
|
-
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } :
|
|
2431
|
-
async
|
|
2425
|
+
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
|
2426
|
+
async generateMiddlewareResponse(query) {
|
|
2432
2427
|
let formState;
|
|
2428
|
+
let skipRevalidation = false;
|
|
2433
2429
|
if (request.method === "POST") {
|
|
2434
2430
|
ctx.runningAction = true;
|
|
2435
2431
|
let result2 = await processServerAction(
|
|
@@ -2454,6 +2450,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2454
2450
|
ctx.redirect?.headers
|
|
2455
2451
|
);
|
|
2456
2452
|
}
|
|
2453
|
+
skipRevalidation = result2?.skipRevalidation ?? false;
|
|
2457
2454
|
actionResult = result2?.actionResult;
|
|
2458
2455
|
formState = result2?.formState;
|
|
2459
2456
|
request = result2?.revalidationRequest ?? request;
|
|
@@ -2469,7 +2466,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2469
2466
|
);
|
|
2470
2467
|
}
|
|
2471
2468
|
}
|
|
2472
|
-
let staticContext = await query(
|
|
2469
|
+
let staticContext = await query(
|
|
2470
|
+
request,
|
|
2471
|
+
skipRevalidation ? {
|
|
2472
|
+
filterMatchesToLoad: () => false
|
|
2473
|
+
} : void 0
|
|
2474
|
+
);
|
|
2473
2475
|
if (isResponse(staticContext)) {
|
|
2474
2476
|
return generateRedirectResponse(
|
|
2475
2477
|
staticContext,
|
|
@@ -2493,6 +2495,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2493
2495
|
formState,
|
|
2494
2496
|
staticContext,
|
|
2495
2497
|
temporaryReferences,
|
|
2498
|
+
skipRevalidation,
|
|
2496
2499
|
ctx.redirect?.headers
|
|
2497
2500
|
);
|
|
2498
2501
|
}
|
|
@@ -2544,7 +2547,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques
|
|
|
2544
2547
|
{ temporaryReferences }
|
|
2545
2548
|
);
|
|
2546
2549
|
}
|
|
2547
|
-
async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, sideEffectRedirectHeaders) {
|
|
2550
|
+
async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) {
|
|
2548
2551
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2549
2552
|
if (staticContext.errors) {
|
|
2550
2553
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2591,7 +2594,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
|
|
|
2591
2594
|
payload = {
|
|
2592
2595
|
type: "action",
|
|
2593
2596
|
actionResult,
|
|
2594
|
-
rerender: renderPayloadPromise()
|
|
2597
|
+
rerender: skipRevalidation ? void 0 : renderPayloadPromise()
|
|
2595
2598
|
};
|
|
2596
2599
|
} else if (isSubmission && isDataRequest) {
|
|
2597
2600
|
payload = {
|
|
@@ -3158,4 +3161,4 @@ function createMemorySessionStorage({ cookie } = {}) {
|
|
|
3158
3161
|
});
|
|
3159
3162
|
}
|
|
3160
3163
|
|
|
3161
|
-
export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isSession, matchRoutes, redirect2 as redirect, redirectDocument2 as redirectDocument, replace2 as replace,
|
|
3164
|
+
export { RouterContextProvider, createContext, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isRouteErrorResponse, isSession, matchRoutes, redirect2 as redirect, redirectDocument2 as redirectDocument, replace2 as replace, matchRSCServerRequest as unstable_matchRSCServerRequest };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActionFunctionArgs, aC as Await, ar as AwaitProps,
|
|
1
|
+
import { j as Router, k as DataStrategyFunction, T as To, N as NavigateOptions, B as BlockerFunction, l as Blocker, m as RelativeRoutingType, L as Location, n as ParamParseKey, o as Path, p as PathPattern, q as PathMatch, U as UIMatch, r as Navigation, s as Action, P as Params, t as RouteObject, I as InitialEntry, H as HydrationState, v as IndexRouteObject, w as RouteComponentType, x as HydrateFallbackType, E as ErrorBoundaryType, d as LoaderFunction, c as ActionFunction, y as NonIndexRouteObject, g as RouterContextProvider, i as MiddlewareEnabled, S as ShouldRevalidateFunction, a as RouterInit, z as RouterState, C as PatchRoutesOnNavigationFunction, F as DataRouteObject } from './context-EwD9faH7.mjs';
|
|
2
|
+
export { A as ActionFunctionArgs, aC as Await, ar as AwaitProps, e as DataRouteMatch, _ as DataStrategyFunctionArgs, $ as DataStrategyMatch, D as DataStrategyResult, a0 as ErrorResponse, Q as Fetcher, a1 as FormEncType, a2 as FormMethod, aO as Future, J as GetScrollPositionFunction, K as GetScrollRestorationKeyFunction, a3 as HTMLFormMethod, ae as IDLE_BLOCKER, ad as IDLE_FETCHER, ac as IDLE_NAVIGATION, as as IndexRouteProps, at as LayoutRouteProps, a4 as LazyRouteFunction, b as LoaderFunctionArgs, aD as MemoryRouter, au as MemoryRouterOpts, av as MemoryRouterProps, f as MiddlewareFunction, aE as Navigate, aw as NavigateProps, V as NavigationStates, ao as Navigator, aF as Outlet, ax as OutletProps, ap as PatchRoutesOnNavigationFunctionArgs, a5 as PathParam, ay as PathRouteProps, a6 as RedirectFunction, Z as RevalidationState, aG as Route, aq as RouteMatch, az as RouteProps, aH as Router, a7 as RouterContext, Y as RouterFetchOptions, X as RouterNavigateOptions, aA as RouterProps, aI as RouterProvider, R as RouterProviderProps, W as RouterSubscriber, aJ as Routes, aB as RoutesProps, a8 as ShouldRevalidateFunctionArgs, G as StaticHandler, O as StaticHandlerContext, aT as UNSAFE_DataRouterContext, aU as UNSAFE_DataRouterStateContext, h as UNSAFE_DataWithResponseInit, aS as UNSAFE_ErrorResponseImpl, aV as UNSAFE_FetchersContext, aW as UNSAFE_LocationContext, aX as UNSAFE_NavigationContext, aY as UNSAFE_RouteContext, aZ as UNSAFE_ViewTransitionContext, b0 as UNSAFE_WithComponentProps, b4 as UNSAFE_WithErrorBoundaryProps, b2 as UNSAFE_WithHydrateFallbackProps, aP as UNSAFE_createBrowserHistory, aR as UNSAFE_createRouter, a_ as UNSAFE_hydrationRouteProperties, aQ as UNSAFE_invariant, a$ as UNSAFE_mapRouteProperties, b1 as UNSAFE_withComponentProps, b5 as UNSAFE_withErrorBoundaryProps, b3 as UNSAFE_withHydrateFallbackProps, a9 as createContext, aK as createMemoryRouter, aa as createPath, aL as createRoutesFromChildren, aM as createRoutesFromElements, af as data, ag as generatePath, ah as isRouteErrorResponse, ai as matchPath, aj as matchRoutes, ab as parsePath, ak as redirect, al as redirectDocument, aN as renderMatches, am as replace, an as resolvePath, u as unstable_ClientOnErrorFunction } from './context-EwD9faH7.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { ReactElement } from 'react';
|
|
5
|
-
import { c as RouteModules, d as SerializeFrom, e as MetaFunction, f as LinksFunction, A as AppLoadContext, E as Equal, g as ClientActionFunction, h as ClientLoaderFunction, H as HeadersFunction } from './route-data-
|
|
6
|
-
export { i as ClientActionFunctionArgs, j as ClientLoaderFunctionArgs, k as HeadersArgs, n as HtmlLinkDescriptor, L as LinkDescriptor, l as MetaArgs, M as MetaDescriptor, m as PageLinkDescriptor, u as unstable_SerializesTo } from './route-data-
|
|
7
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig, S as ServerBuild } from './index-react-server-client-
|
|
8
|
-
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-
|
|
5
|
+
import { c as RouteModules, d as SerializeFrom, e as MetaFunction, f as LinksFunction, A as AppLoadContext, E as Equal, g as ClientActionFunction, h as ClientLoaderFunction, H as HeadersFunction } from './route-data-CAnRKu1U.mjs';
|
|
6
|
+
export { i as ClientActionFunctionArgs, j as ClientLoaderFunctionArgs, k as HeadersArgs, n as HtmlLinkDescriptor, L as LinkDescriptor, l as MetaArgs, M as MetaDescriptor, m as PageLinkDescriptor, u as unstable_SerializesTo } from './route-data-CAnRKu1U.mjs';
|
|
7
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig, S as ServerBuild } from './index-react-server-client-DDdP8ud2.mjs';
|
|
8
|
+
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DDdP8ud2.mjs';
|
|
9
9
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
10
10
|
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
11
11
|
import { P as Pages } from './register-DiOIlEq5.mjs';
|
|
@@ -218,6 +218,44 @@ interface NavigateFunction {
|
|
|
218
218
|
* middle of a page, and you don't want it to scroll to the top when a tab is
|
|
219
219
|
* clicked.
|
|
220
220
|
*
|
|
221
|
+
* ### Return Type Augmentation
|
|
222
|
+
*
|
|
223
|
+
* Internally, `useNavigate` uses a separate implementation when you are in
|
|
224
|
+
* Declarative mode versus Data/Framework mode - the primary difference being
|
|
225
|
+
* that the latter is able to return a stable reference that does not change
|
|
226
|
+
* identity across navigations. The implementation in Data/Framework mode also
|
|
227
|
+
* returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
|
228
|
+
* that resolves when the navigation is completed. This means the return type of
|
|
229
|
+
* `useNavigate` is `void | Promise<void>`. This is accurate, but can lead to
|
|
230
|
+
* some red squigglies based on the union in the return value:
|
|
231
|
+
*
|
|
232
|
+
* - If you're using `typescript-eslint`, you may see errors from
|
|
233
|
+
* [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises)
|
|
234
|
+
* - In Framework/Data mode, `React.use(navigate())` will show a false-positive
|
|
235
|
+
* `Argument of type 'void | Promise<void>' is not assignable to parameter of
|
|
236
|
+
* type 'Usable<void>'` error
|
|
237
|
+
*
|
|
238
|
+
* The easiest way to work around these issues is to augment the type based on the
|
|
239
|
+
* router you're using:
|
|
240
|
+
*
|
|
241
|
+
* ```ts
|
|
242
|
+
* // If using <BrowserRouter>
|
|
243
|
+
* declare module "react-router" {
|
|
244
|
+
* interface NavigateFunction {
|
|
245
|
+
* (to: To, options?: NavigateOptions): void;
|
|
246
|
+
* (delta: number): void;
|
|
247
|
+
* }
|
|
248
|
+
* }
|
|
249
|
+
*
|
|
250
|
+
* // If using <RouterProvider> or Framework mode
|
|
251
|
+
* declare module "react-router" {
|
|
252
|
+
* interface NavigateFunction {
|
|
253
|
+
* (to: To, options?: NavigateOptions): Promise<void>;
|
|
254
|
+
* (delta: number): Promise<void>;
|
|
255
|
+
* }
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
221
259
|
* @public
|
|
222
260
|
* @category Hooks
|
|
223
261
|
* @returns A navigate function for programmatic navigation
|
|
@@ -906,7 +944,7 @@ interface RoutesTestStubProps {
|
|
|
906
944
|
/**
|
|
907
945
|
* @category Utils
|
|
908
946
|
*/
|
|
909
|
-
declare function createRoutesStub(routes: StubRouteObject[], _context?: AppLoadContext |
|
|
947
|
+
declare function createRoutesStub(routes: StubRouteObject[], _context?: AppLoadContext | RouterContextProvider): ({ initialEntries, initialIndex, hydrationData, future, }: RoutesTestStubProps) => React.JSX.Element;
|
|
910
948
|
|
|
911
949
|
interface CookieSignatureOptions {
|
|
912
950
|
/**
|
|
@@ -969,7 +1007,7 @@ type IsCookieFunction = (object: any) => object is Cookie;
|
|
|
969
1007
|
*/
|
|
970
1008
|
declare const isCookie: IsCookieFunction;
|
|
971
1009
|
|
|
972
|
-
type RequestHandler = (request: Request, loadContext?: MiddlewareEnabled extends true ?
|
|
1010
|
+
type RequestHandler = (request: Request, loadContext?: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext) => Promise<Response>;
|
|
973
1011
|
type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
|
|
974
1012
|
declare const createRequestHandler: CreateRequestHandlerFunction;
|
|
975
1013
|
|
|
@@ -1324,7 +1362,7 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
|
1324
1362
|
* errors that occur during the request processing.
|
|
1325
1363
|
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
1326
1364
|
* to match against.
|
|
1327
|
-
* @param opts.requestContext An instance of {@link
|
|
1365
|
+
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
|
1328
1366
|
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
|
1329
1367
|
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
1330
1368
|
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
|
@@ -1338,7 +1376,7 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename,
|
|
|
1338
1376
|
decodeReply?: DecodeReplyFunction;
|
|
1339
1377
|
decodeAction?: DecodeActionFunction;
|
|
1340
1378
|
decodeFormState?: DecodeFormStateFunction;
|
|
1341
|
-
requestContext?:
|
|
1379
|
+
requestContext?: RouterContextProvider;
|
|
1342
1380
|
loadServerAction?: LoadServerActionFunction;
|
|
1343
1381
|
onError?: (error: unknown) => void;
|
|
1344
1382
|
request: Request;
|
|
@@ -1422,13 +1460,13 @@ interface RSCHydratedRouterProps {
|
|
|
1422
1460
|
*/
|
|
1423
1461
|
routeDiscovery?: "eager" | "lazy";
|
|
1424
1462
|
/**
|
|
1425
|
-
* A function that returns an {@link
|
|
1463
|
+
* A function that returns an {@link RouterContextProvider} instance
|
|
1426
1464
|
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
|
1427
1465
|
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
1428
1466
|
* This function is called to generate a fresh `context` instance on each
|
|
1429
1467
|
* navigation or fetcher call.
|
|
1430
1468
|
*/
|
|
1431
|
-
|
|
1469
|
+
getContext?: RouterInit["getContext"];
|
|
1432
1470
|
}
|
|
1433
1471
|
/**
|
|
1434
1472
|
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
|
@@ -1464,13 +1502,13 @@ interface RSCHydratedRouterProps {
|
|
|
1464
1502
|
* @param props Props
|
|
1465
1503
|
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
|
1466
1504
|
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
|
1467
|
-
* @param {unstable_RSCHydratedRouterProps.
|
|
1505
|
+
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
|
1468
1506
|
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
|
1469
1507
|
* @param {unstable_RSCHydratedRouterProps.routeDiscovery} props.routeDiscovery n/a
|
|
1470
1508
|
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
|
1471
1509
|
* render routes.
|
|
1472
1510
|
*/
|
|
1473
|
-
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery,
|
|
1511
|
+
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
|
1474
1512
|
|
|
1475
1513
|
type SSRCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>) => Promise<unknown>;
|
|
1476
1514
|
/**
|
|
@@ -1629,4 +1667,4 @@ declare function getHydrationData(state: {
|
|
|
1629
1667
|
|
|
1630
1668
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
1631
1669
|
|
|
1632
|
-
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientActionFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HeadersFunction, 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, RelativeRoutingType, type RequestHandler, RouteObject, RouterInit, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, ShouldRevalidateFunction, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, 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, href, isCookie, isSession, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps,
|
|
1670
|
+
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientActionFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HeadersFunction, 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, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterInit, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, ShouldRevalidateFunction, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, 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, href, isCookie, isSession, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, createCallServer as unstable_createCallServer, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, 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 };
|