react-router 0.0.0-experimental-ab9ed70c6 → 0.0.0-experimental-d431f1b65
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/{browser-BPyO7zih.d.mts → browser-Dr0PjLWi.d.mts} +1 -0
- package/dist/development/{chunk-44SHGOVW.mjs → chunk-F37344ZN.mjs} +2 -2
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +2 -2
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +2 -2
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/rsc-export.d.mts +4 -1
- package/dist/development/rsc-export.d.ts +4 -1
- package/dist/development/rsc-export.js +16 -6
- package/dist/development/rsc-export.mjs +16 -6
- package/dist/production/{browser-BPyO7zih.d.mts → browser-Dr0PjLWi.d.mts} +1 -0
- package/dist/production/{chunk-OMKPJEIF.mjs → chunk-LTAAPV3T.mjs} +2 -2
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +2 -2
- package/dist/production/index.d.ts +1 -0
- package/dist/production/index.js +2 -2
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/rsc-export.d.mts +4 -1
- package/dist/production/rsc-export.d.ts +4 -1
- package/dist/production/rsc-export.js +16 -6
- package/dist/production/rsc-export.mjs +16 -6
- 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-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8804,7 +8804,7 @@ function mergeRefs(...refs) {
|
|
|
8804
8804
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8805
8805
|
try {
|
|
8806
8806
|
if (isBrowser) {
|
|
8807
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8807
|
+
window.__reactRouterVersion = "0.0.0-experimental-d431f1b65";
|
|
8808
8808
|
}
|
|
8809
8809
|
} catch (e) {
|
|
8810
8810
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-Dr0PjLWi.mjs';
|
|
3
3
|
import { R as RouterInit } from './route-data-C8_wxpLo.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
invariant,
|
|
27
27
|
mapRouteProperties,
|
|
28
28
|
useFogOFWarDiscovery
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-F37344ZN.mjs";
|
|
30
30
|
|
|
31
31
|
// lib/dom-export/dom-router-provider.tsx
|
|
32
32
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, L as Location, S as StaticHandlerContext, c as RouteObject, C as CreateStaticHandlerOptions$1, d as StaticHandler, F as FutureConfig, I as InitialEntry, H as HydrationState, e as IndexRouteObject, f as LoaderFunction, A as ActionFunction, M as MetaFunction, g as LinksFunction, N as NonIndexRouteObject, u as unstable_InitialContext, h as MiddlewareEnabled, i as AppLoadContext, E as Equal, j as RouterState, P as PatchRoutesOnNavigationFunction, k as DataRouteObject, l as ClientLoaderFunction, m as Path } from './route-data-C8_wxpLo.mjs';
|
|
2
2
|
export { y as ActionFunctionArgs, B as Blocker, s as BlockerFunction, au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunctionArgs, ap as DataRouteMatch, z as DataStrategyFunctionArgs, J as DataStrategyMatch, K as DataStrategyResult, Q as ErrorResponse, o as Fetcher, U as FormEncType, V as FormMethod, aE as Future, G as GetScrollPositionFunction, n as GetScrollRestorationKeyFunction, W as HTMLFormMethod, ax as HeadersArgs, ay as HeadersFunction, aC as HtmlLinkDescriptor, af as IDLE_BLOCKER, ae as IDLE_FETCHER, ad as IDLE_NAVIGATION, X as LazyRouteFunction, aD as LinkDescriptor, Y as LoaderFunctionArgs, az as MetaArgs, aA as MetaDescriptor, aq as NavigateOptions, p as Navigation, q as NavigationStates, aa as NavigationType, ar as Navigator, aB as PageLinkDescriptor, _ as ParamParseKey, $ as Params, as as PatchRoutesOnNavigationFunctionArgs, a0 as PathMatch, a1 as PathParam, a2 as PathPattern, a3 as RedirectFunction, r as RelativeRoutingType, x as RevalidationState, at as RouteMatch, w as RouterFetchOptions, R as RouterInit, v as RouterNavigateOptions, t as RouterSubscriber, a5 as ShouldRevalidateFunction, a6 as ShouldRevalidateFunctionArgs, T as To, a7 as UIMatch, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, O as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, ab as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, ac as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, Z as unstable_MiddlewareFunction, a4 as unstable_RouterContext, a9 as unstable_RouterContextProvider, aF as unstable_SerializesTo, a8 as unstable_createContext } from './route-data-C8_wxpLo.mjs';
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-
|
|
4
|
-
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-Dr0PjLWi.mjs';
|
|
4
|
+
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-Dr0PjLWi.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8964,7 +8964,7 @@ function mergeRefs(...refs) {
|
|
|
8964
8964
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8965
8965
|
try {
|
|
8966
8966
|
if (isBrowser) {
|
|
8967
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8967
|
+
window.__reactRouterVersion = "0.0.0-experimental-d431f1b65";
|
|
8968
8968
|
}
|
|
8969
8969
|
} catch (e) {
|
|
8970
8970
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
withComponentProps,
|
|
136
136
|
withErrorBoundaryProps,
|
|
137
137
|
withHydrateFallbackProps
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-F37344ZN.mjs";
|
|
139
139
|
export {
|
|
140
140
|
Await,
|
|
141
141
|
BrowserRouter,
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* react-router v0.0.0-experimental-
|
|
28
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
31
31
|
*
|
|
@@ -2448,6 +2448,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2448
2448
|
async function matchRSCServerRequest({
|
|
2449
2449
|
decodeCallServer,
|
|
2450
2450
|
decodeFormAction,
|
|
2451
|
+
decodeFormState,
|
|
2451
2452
|
onError,
|
|
2452
2453
|
request,
|
|
2453
2454
|
routes,
|
|
@@ -2494,6 +2495,7 @@ async function matchRSCServerRequest({
|
|
|
2494
2495
|
isDataRequest,
|
|
2495
2496
|
decodeCallServer,
|
|
2496
2497
|
decodeFormAction,
|
|
2498
|
+
decodeFormState,
|
|
2497
2499
|
onError,
|
|
2498
2500
|
generateResponse
|
|
2499
2501
|
);
|
|
@@ -2534,7 +2536,7 @@ async function generateManifestResponse(routes, request, generateResponse) {
|
|
|
2534
2536
|
payload
|
|
2535
2537
|
});
|
|
2536
2538
|
}
|
|
2537
|
-
async function processServerAction(request, decodeCallServer, decodeFormAction, onError) {
|
|
2539
|
+
async function processServerAction(request, decodeCallServer, decodeFormAction, decodeFormState, onError) {
|
|
2538
2540
|
const getRevalidationRequest = () => new Request(request.url, {
|
|
2539
2541
|
method: "GET",
|
|
2540
2542
|
headers: request.headers,
|
|
@@ -2574,8 +2576,10 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2574
2576
|
);
|
|
2575
2577
|
}
|
|
2576
2578
|
const action = await decodeFormAction(formData);
|
|
2579
|
+
let formState = void 0;
|
|
2577
2580
|
try {
|
|
2578
|
-
await action();
|
|
2581
|
+
const result = await action();
|
|
2582
|
+
formState = decodeFormState?.(result, formData);
|
|
2579
2583
|
} catch (error) {
|
|
2580
2584
|
if (isResponse(error)) {
|
|
2581
2585
|
return error;
|
|
@@ -2583,6 +2587,7 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2583
2587
|
onError?.(error);
|
|
2584
2588
|
}
|
|
2585
2589
|
return {
|
|
2590
|
+
formState,
|
|
2586
2591
|
revalidationRequest: getRevalidationRequest()
|
|
2587
2592
|
};
|
|
2588
2593
|
}
|
|
@@ -2628,7 +2633,7 @@ async function generateResourceResponse(request, routes, routeId, onError) {
|
|
|
2628
2633
|
headers
|
|
2629
2634
|
});
|
|
2630
2635
|
}
|
|
2631
|
-
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, onError, generateResponse) {
|
|
2636
|
+
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, decodeFormState, onError, generateResponse) {
|
|
2632
2637
|
let statusCode = 200;
|
|
2633
2638
|
let url = new URL(request.url);
|
|
2634
2639
|
let isSubmission = isMutationMethod(request.method);
|
|
@@ -2644,17 +2649,20 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2644
2649
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : null,
|
|
2645
2650
|
async unstable_stream(_, query) {
|
|
2646
2651
|
let actionResult;
|
|
2652
|
+
let formState;
|
|
2647
2653
|
if (request.method === "POST") {
|
|
2648
2654
|
let result2 = await processServerAction(
|
|
2649
2655
|
request,
|
|
2650
2656
|
decodeCallServer,
|
|
2651
2657
|
decodeFormAction,
|
|
2658
|
+
decodeFormState,
|
|
2652
2659
|
onError
|
|
2653
2660
|
);
|
|
2654
2661
|
if (isResponse(result2)) {
|
|
2655
2662
|
return generateRedirectResponse(statusCode, result2, generateResponse);
|
|
2656
2663
|
}
|
|
2657
2664
|
actionResult = result2?.actionResult;
|
|
2665
|
+
formState = result2?.formState;
|
|
2658
2666
|
request = result2?.revalidationRequest ?? request;
|
|
2659
2667
|
}
|
|
2660
2668
|
let staticContext = await query(request);
|
|
@@ -2673,6 +2681,7 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2673
2681
|
isDataRequest,
|
|
2674
2682
|
isSubmission,
|
|
2675
2683
|
actionResult,
|
|
2684
|
+
formState,
|
|
2676
2685
|
staticContext
|
|
2677
2686
|
);
|
|
2678
2687
|
}
|
|
@@ -2700,7 +2709,7 @@ function generateRedirectResponse(statusCode, response, generateResponse) {
|
|
|
2700
2709
|
payload
|
|
2701
2710
|
});
|
|
2702
2711
|
}
|
|
2703
|
-
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, staticContext) {
|
|
2712
|
+
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext) {
|
|
2704
2713
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2705
2714
|
if (staticContext.errors) {
|
|
2706
2715
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2724,7 +2733,8 @@ async function generateStaticContextResponse(routes, generateResponse, statusCod
|
|
|
2724
2733
|
actionData: staticContext.actionData,
|
|
2725
2734
|
errors: staticContext.errors,
|
|
2726
2735
|
loaderData: staticContext.loaderData,
|
|
2727
|
-
location: staticContext.location
|
|
2736
|
+
location: staticContext.location,
|
|
2737
|
+
formState
|
|
2728
2738
|
};
|
|
2729
2739
|
const renderPayloadPromise = () => getRenderPayload(
|
|
2730
2740
|
baseRenderPayload,
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { splitCookiesString } from 'set-cookie-parser';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* react-router v0.0.0-experimental-
|
|
6
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Remix Software Inc.
|
|
9
9
|
*
|
|
@@ -2426,6 +2426,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2426
2426
|
async function matchRSCServerRequest({
|
|
2427
2427
|
decodeCallServer,
|
|
2428
2428
|
decodeFormAction,
|
|
2429
|
+
decodeFormState,
|
|
2429
2430
|
onError,
|
|
2430
2431
|
request,
|
|
2431
2432
|
routes,
|
|
@@ -2472,6 +2473,7 @@ async function matchRSCServerRequest({
|
|
|
2472
2473
|
isDataRequest,
|
|
2473
2474
|
decodeCallServer,
|
|
2474
2475
|
decodeFormAction,
|
|
2476
|
+
decodeFormState,
|
|
2475
2477
|
onError,
|
|
2476
2478
|
generateResponse
|
|
2477
2479
|
);
|
|
@@ -2512,7 +2514,7 @@ async function generateManifestResponse(routes, request, generateResponse) {
|
|
|
2512
2514
|
payload
|
|
2513
2515
|
});
|
|
2514
2516
|
}
|
|
2515
|
-
async function processServerAction(request, decodeCallServer, decodeFormAction, onError) {
|
|
2517
|
+
async function processServerAction(request, decodeCallServer, decodeFormAction, decodeFormState, onError) {
|
|
2516
2518
|
const getRevalidationRequest = () => new Request(request.url, {
|
|
2517
2519
|
method: "GET",
|
|
2518
2520
|
headers: request.headers,
|
|
@@ -2552,8 +2554,10 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2552
2554
|
);
|
|
2553
2555
|
}
|
|
2554
2556
|
const action = await decodeFormAction(formData);
|
|
2557
|
+
let formState = void 0;
|
|
2555
2558
|
try {
|
|
2556
|
-
await action();
|
|
2559
|
+
const result = await action();
|
|
2560
|
+
formState = decodeFormState?.(result, formData);
|
|
2557
2561
|
} catch (error) {
|
|
2558
2562
|
if (isResponse(error)) {
|
|
2559
2563
|
return error;
|
|
@@ -2561,6 +2565,7 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2561
2565
|
onError?.(error);
|
|
2562
2566
|
}
|
|
2563
2567
|
return {
|
|
2568
|
+
formState,
|
|
2564
2569
|
revalidationRequest: getRevalidationRequest()
|
|
2565
2570
|
};
|
|
2566
2571
|
}
|
|
@@ -2606,7 +2611,7 @@ async function generateResourceResponse(request, routes, routeId, onError) {
|
|
|
2606
2611
|
headers
|
|
2607
2612
|
});
|
|
2608
2613
|
}
|
|
2609
|
-
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, onError, generateResponse) {
|
|
2614
|
+
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, decodeFormState, onError, generateResponse) {
|
|
2610
2615
|
let statusCode = 200;
|
|
2611
2616
|
let url = new URL(request.url);
|
|
2612
2617
|
let isSubmission = isMutationMethod(request.method);
|
|
@@ -2622,17 +2627,20 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2622
2627
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : null,
|
|
2623
2628
|
async unstable_stream(_, query) {
|
|
2624
2629
|
let actionResult;
|
|
2630
|
+
let formState;
|
|
2625
2631
|
if (request.method === "POST") {
|
|
2626
2632
|
let result2 = await processServerAction(
|
|
2627
2633
|
request,
|
|
2628
2634
|
decodeCallServer,
|
|
2629
2635
|
decodeFormAction,
|
|
2636
|
+
decodeFormState,
|
|
2630
2637
|
onError
|
|
2631
2638
|
);
|
|
2632
2639
|
if (isResponse(result2)) {
|
|
2633
2640
|
return generateRedirectResponse(statusCode, result2, generateResponse);
|
|
2634
2641
|
}
|
|
2635
2642
|
actionResult = result2?.actionResult;
|
|
2643
|
+
formState = result2?.formState;
|
|
2636
2644
|
request = result2?.revalidationRequest ?? request;
|
|
2637
2645
|
}
|
|
2638
2646
|
let staticContext = await query(request);
|
|
@@ -2651,6 +2659,7 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2651
2659
|
isDataRequest,
|
|
2652
2660
|
isSubmission,
|
|
2653
2661
|
actionResult,
|
|
2662
|
+
formState,
|
|
2654
2663
|
staticContext
|
|
2655
2664
|
);
|
|
2656
2665
|
}
|
|
@@ -2678,7 +2687,7 @@ function generateRedirectResponse(statusCode, response, generateResponse) {
|
|
|
2678
2687
|
payload
|
|
2679
2688
|
});
|
|
2680
2689
|
}
|
|
2681
|
-
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, staticContext) {
|
|
2690
|
+
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext) {
|
|
2682
2691
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2683
2692
|
if (staticContext.errors) {
|
|
2684
2693
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2702,7 +2711,8 @@ async function generateStaticContextResponse(routes, generateResponse, statusCod
|
|
|
2702
2711
|
actionData: staticContext.actionData,
|
|
2703
2712
|
errors: staticContext.errors,
|
|
2704
2713
|
loaderData: staticContext.loaderData,
|
|
2705
|
-
location: staticContext.location
|
|
2714
|
+
location: staticContext.location,
|
|
2715
|
+
formState
|
|
2706
2716
|
};
|
|
2707
2717
|
const renderPayloadPromise = () => getRenderPayload(
|
|
2708
2718
|
baseRenderPayload,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8804,7 +8804,7 @@ function mergeRefs(...refs) {
|
|
|
8804
8804
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8805
8805
|
try {
|
|
8806
8806
|
if (isBrowser) {
|
|
8807
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8807
|
+
window.__reactRouterVersion = "0.0.0-experimental-d431f1b65";
|
|
8808
8808
|
}
|
|
8809
8809
|
} catch (e) {
|
|
8810
8810
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-Dr0PjLWi.mjs';
|
|
3
3
|
import { R as RouterInit } from './route-data-C8_wxpLo.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
invariant,
|
|
27
27
|
mapRouteProperties,
|
|
28
28
|
useFogOFWarDiscovery
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LTAAPV3T.mjs";
|
|
30
30
|
|
|
31
31
|
// lib/dom-export/dom-router-provider.tsx
|
|
32
32
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, L as Location, S as StaticHandlerContext, c as RouteObject, C as CreateStaticHandlerOptions$1, d as StaticHandler, F as FutureConfig, I as InitialEntry, H as HydrationState, e as IndexRouteObject, f as LoaderFunction, A as ActionFunction, M as MetaFunction, g as LinksFunction, N as NonIndexRouteObject, u as unstable_InitialContext, h as MiddlewareEnabled, i as AppLoadContext, E as Equal, j as RouterState, P as PatchRoutesOnNavigationFunction, k as DataRouteObject, l as ClientLoaderFunction, m as Path } from './route-data-C8_wxpLo.mjs';
|
|
2
2
|
export { y as ActionFunctionArgs, B as Blocker, s as BlockerFunction, au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunctionArgs, ap as DataRouteMatch, z as DataStrategyFunctionArgs, J as DataStrategyMatch, K as DataStrategyResult, Q as ErrorResponse, o as Fetcher, U as FormEncType, V as FormMethod, aE as Future, G as GetScrollPositionFunction, n as GetScrollRestorationKeyFunction, W as HTMLFormMethod, ax as HeadersArgs, ay as HeadersFunction, aC as HtmlLinkDescriptor, af as IDLE_BLOCKER, ae as IDLE_FETCHER, ad as IDLE_NAVIGATION, X as LazyRouteFunction, aD as LinkDescriptor, Y as LoaderFunctionArgs, az as MetaArgs, aA as MetaDescriptor, aq as NavigateOptions, p as Navigation, q as NavigationStates, aa as NavigationType, ar as Navigator, aB as PageLinkDescriptor, _ as ParamParseKey, $ as Params, as as PatchRoutesOnNavigationFunctionArgs, a0 as PathMatch, a1 as PathParam, a2 as PathPattern, a3 as RedirectFunction, r as RelativeRoutingType, x as RevalidationState, at as RouteMatch, w as RouterFetchOptions, R as RouterInit, v as RouterNavigateOptions, t as RouterSubscriber, a5 as ShouldRevalidateFunction, a6 as ShouldRevalidateFunctionArgs, T as To, a7 as UIMatch, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, O as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, ab as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, ac as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, Z as unstable_MiddlewareFunction, a4 as unstable_RouterContext, a9 as unstable_RouterContextProvider, aF as unstable_SerializesTo, a8 as unstable_createContext } from './route-data-C8_wxpLo.mjs';
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-
|
|
4
|
-
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-Dr0PjLWi.mjs';
|
|
4
|
+
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-Dr0PjLWi.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8964,7 +8964,7 @@ function mergeRefs(...refs) {
|
|
|
8964
8964
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8965
8965
|
try {
|
|
8966
8966
|
if (isBrowser) {
|
|
8967
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8967
|
+
window.__reactRouterVersion = "0.0.0-experimental-d431f1b65";
|
|
8968
8968
|
}
|
|
8969
8969
|
} catch (e) {
|
|
8970
8970
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
withComponentProps,
|
|
136
136
|
withErrorBoundaryProps,
|
|
137
137
|
withHydrateFallbackProps
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-LTAAPV3T.mjs";
|
|
139
139
|
export {
|
|
140
140
|
Await,
|
|
141
141
|
BrowserRouter,
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* react-router v0.0.0-experimental-
|
|
28
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
31
31
|
*
|
|
@@ -2448,6 +2448,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2448
2448
|
async function matchRSCServerRequest({
|
|
2449
2449
|
decodeCallServer,
|
|
2450
2450
|
decodeFormAction,
|
|
2451
|
+
decodeFormState,
|
|
2451
2452
|
onError,
|
|
2452
2453
|
request,
|
|
2453
2454
|
routes,
|
|
@@ -2494,6 +2495,7 @@ async function matchRSCServerRequest({
|
|
|
2494
2495
|
isDataRequest,
|
|
2495
2496
|
decodeCallServer,
|
|
2496
2497
|
decodeFormAction,
|
|
2498
|
+
decodeFormState,
|
|
2497
2499
|
onError,
|
|
2498
2500
|
generateResponse
|
|
2499
2501
|
);
|
|
@@ -2534,7 +2536,7 @@ async function generateManifestResponse(routes, request, generateResponse) {
|
|
|
2534
2536
|
payload
|
|
2535
2537
|
});
|
|
2536
2538
|
}
|
|
2537
|
-
async function processServerAction(request, decodeCallServer, decodeFormAction, onError) {
|
|
2539
|
+
async function processServerAction(request, decodeCallServer, decodeFormAction, decodeFormState, onError) {
|
|
2538
2540
|
const getRevalidationRequest = () => new Request(request.url, {
|
|
2539
2541
|
method: "GET",
|
|
2540
2542
|
headers: request.headers,
|
|
@@ -2574,8 +2576,10 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2574
2576
|
);
|
|
2575
2577
|
}
|
|
2576
2578
|
const action = await decodeFormAction(formData);
|
|
2579
|
+
let formState = void 0;
|
|
2577
2580
|
try {
|
|
2578
|
-
await action();
|
|
2581
|
+
const result = await action();
|
|
2582
|
+
formState = decodeFormState?.(result, formData);
|
|
2579
2583
|
} catch (error) {
|
|
2580
2584
|
if (isResponse(error)) {
|
|
2581
2585
|
return error;
|
|
@@ -2583,6 +2587,7 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2583
2587
|
onError?.(error);
|
|
2584
2588
|
}
|
|
2585
2589
|
return {
|
|
2590
|
+
formState,
|
|
2586
2591
|
revalidationRequest: getRevalidationRequest()
|
|
2587
2592
|
};
|
|
2588
2593
|
}
|
|
@@ -2628,7 +2633,7 @@ async function generateResourceResponse(request, routes, routeId, onError) {
|
|
|
2628
2633
|
headers
|
|
2629
2634
|
});
|
|
2630
2635
|
}
|
|
2631
|
-
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, onError, generateResponse) {
|
|
2636
|
+
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, decodeFormState, onError, generateResponse) {
|
|
2632
2637
|
let statusCode = 200;
|
|
2633
2638
|
let url = new URL(request.url);
|
|
2634
2639
|
let isSubmission = isMutationMethod(request.method);
|
|
@@ -2644,17 +2649,20 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2644
2649
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : null,
|
|
2645
2650
|
async unstable_stream(_, query) {
|
|
2646
2651
|
let actionResult;
|
|
2652
|
+
let formState;
|
|
2647
2653
|
if (request.method === "POST") {
|
|
2648
2654
|
let result2 = await processServerAction(
|
|
2649
2655
|
request,
|
|
2650
2656
|
decodeCallServer,
|
|
2651
2657
|
decodeFormAction,
|
|
2658
|
+
decodeFormState,
|
|
2652
2659
|
onError
|
|
2653
2660
|
);
|
|
2654
2661
|
if (isResponse(result2)) {
|
|
2655
2662
|
return generateRedirectResponse(statusCode, result2, generateResponse);
|
|
2656
2663
|
}
|
|
2657
2664
|
actionResult = result2?.actionResult;
|
|
2665
|
+
formState = result2?.formState;
|
|
2658
2666
|
request = result2?.revalidationRequest ?? request;
|
|
2659
2667
|
}
|
|
2660
2668
|
let staticContext = await query(request);
|
|
@@ -2673,6 +2681,7 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2673
2681
|
isDataRequest,
|
|
2674
2682
|
isSubmission,
|
|
2675
2683
|
actionResult,
|
|
2684
|
+
formState,
|
|
2676
2685
|
staticContext
|
|
2677
2686
|
);
|
|
2678
2687
|
}
|
|
@@ -2700,7 +2709,7 @@ function generateRedirectResponse(statusCode, response, generateResponse) {
|
|
|
2700
2709
|
payload
|
|
2701
2710
|
});
|
|
2702
2711
|
}
|
|
2703
|
-
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, staticContext) {
|
|
2712
|
+
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext) {
|
|
2704
2713
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2705
2714
|
if (staticContext.errors) {
|
|
2706
2715
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2724,7 +2733,8 @@ async function generateStaticContextResponse(routes, generateResponse, statusCod
|
|
|
2724
2733
|
actionData: staticContext.actionData,
|
|
2725
2734
|
errors: staticContext.errors,
|
|
2726
2735
|
loaderData: staticContext.loaderData,
|
|
2727
|
-
location: staticContext.location
|
|
2736
|
+
location: staticContext.location,
|
|
2737
|
+
formState
|
|
2728
2738
|
};
|
|
2729
2739
|
const renderPayloadPromise = () => getRenderPayload(
|
|
2730
2740
|
baseRenderPayload,
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { splitCookiesString } from 'set-cookie-parser';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* react-router v0.0.0-experimental-
|
|
6
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Remix Software Inc.
|
|
9
9
|
*
|
|
@@ -2426,6 +2426,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2426
2426
|
async function matchRSCServerRequest({
|
|
2427
2427
|
decodeCallServer,
|
|
2428
2428
|
decodeFormAction,
|
|
2429
|
+
decodeFormState,
|
|
2429
2430
|
onError,
|
|
2430
2431
|
request,
|
|
2431
2432
|
routes,
|
|
@@ -2472,6 +2473,7 @@ async function matchRSCServerRequest({
|
|
|
2472
2473
|
isDataRequest,
|
|
2473
2474
|
decodeCallServer,
|
|
2474
2475
|
decodeFormAction,
|
|
2476
|
+
decodeFormState,
|
|
2475
2477
|
onError,
|
|
2476
2478
|
generateResponse
|
|
2477
2479
|
);
|
|
@@ -2512,7 +2514,7 @@ async function generateManifestResponse(routes, request, generateResponse) {
|
|
|
2512
2514
|
payload
|
|
2513
2515
|
});
|
|
2514
2516
|
}
|
|
2515
|
-
async function processServerAction(request, decodeCallServer, decodeFormAction, onError) {
|
|
2517
|
+
async function processServerAction(request, decodeCallServer, decodeFormAction, decodeFormState, onError) {
|
|
2516
2518
|
const getRevalidationRequest = () => new Request(request.url, {
|
|
2517
2519
|
method: "GET",
|
|
2518
2520
|
headers: request.headers,
|
|
@@ -2552,8 +2554,10 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2552
2554
|
);
|
|
2553
2555
|
}
|
|
2554
2556
|
const action = await decodeFormAction(formData);
|
|
2557
|
+
let formState = void 0;
|
|
2555
2558
|
try {
|
|
2556
|
-
await action();
|
|
2559
|
+
const result = await action();
|
|
2560
|
+
formState = decodeFormState?.(result, formData);
|
|
2557
2561
|
} catch (error) {
|
|
2558
2562
|
if (isResponse(error)) {
|
|
2559
2563
|
return error;
|
|
@@ -2561,6 +2565,7 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2561
2565
|
onError?.(error);
|
|
2562
2566
|
}
|
|
2563
2567
|
return {
|
|
2568
|
+
formState,
|
|
2564
2569
|
revalidationRequest: getRevalidationRequest()
|
|
2565
2570
|
};
|
|
2566
2571
|
}
|
|
@@ -2606,7 +2611,7 @@ async function generateResourceResponse(request, routes, routeId, onError) {
|
|
|
2606
2611
|
headers
|
|
2607
2612
|
});
|
|
2608
2613
|
}
|
|
2609
|
-
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, onError, generateResponse) {
|
|
2614
|
+
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, decodeFormState, onError, generateResponse) {
|
|
2610
2615
|
let statusCode = 200;
|
|
2611
2616
|
let url = new URL(request.url);
|
|
2612
2617
|
let isSubmission = isMutationMethod(request.method);
|
|
@@ -2622,17 +2627,20 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2622
2627
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : null,
|
|
2623
2628
|
async unstable_stream(_, query) {
|
|
2624
2629
|
let actionResult;
|
|
2630
|
+
let formState;
|
|
2625
2631
|
if (request.method === "POST") {
|
|
2626
2632
|
let result2 = await processServerAction(
|
|
2627
2633
|
request,
|
|
2628
2634
|
decodeCallServer,
|
|
2629
2635
|
decodeFormAction,
|
|
2636
|
+
decodeFormState,
|
|
2630
2637
|
onError
|
|
2631
2638
|
);
|
|
2632
2639
|
if (isResponse(result2)) {
|
|
2633
2640
|
return generateRedirectResponse(statusCode, result2, generateResponse);
|
|
2634
2641
|
}
|
|
2635
2642
|
actionResult = result2?.actionResult;
|
|
2643
|
+
formState = result2?.formState;
|
|
2636
2644
|
request = result2?.revalidationRequest ?? request;
|
|
2637
2645
|
}
|
|
2638
2646
|
let staticContext = await query(request);
|
|
@@ -2651,6 +2659,7 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2651
2659
|
isDataRequest,
|
|
2652
2660
|
isSubmission,
|
|
2653
2661
|
actionResult,
|
|
2662
|
+
formState,
|
|
2654
2663
|
staticContext
|
|
2655
2664
|
);
|
|
2656
2665
|
}
|
|
@@ -2678,7 +2687,7 @@ function generateRedirectResponse(statusCode, response, generateResponse) {
|
|
|
2678
2687
|
payload
|
|
2679
2688
|
});
|
|
2680
2689
|
}
|
|
2681
|
-
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, staticContext) {
|
|
2690
|
+
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext) {
|
|
2682
2691
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2683
2692
|
if (staticContext.errors) {
|
|
2684
2693
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2702,7 +2711,8 @@ async function generateStaticContextResponse(routes, generateResponse, statusCod
|
|
|
2702
2711
|
actionData: staticContext.actionData,
|
|
2703
2712
|
errors: staticContext.errors,
|
|
2704
2713
|
loaderData: staticContext.loaderData,
|
|
2705
|
-
location: staticContext.location
|
|
2714
|
+
location: staticContext.location,
|
|
2715
|
+
formState
|
|
2706
2716
|
};
|
|
2707
2717
|
const renderPayloadPromise = () => getRenderPayload(
|
|
2708
2718
|
baseRenderPayload,
|