react-router 7.9.6-pre.1 → 7.10.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -4
- package/dist/development/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/development/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/development/{chunk-HSVNPM3C.js → chunk-2VILFZWG.js} +167 -123
- package/dist/development/{chunk-DKSAHU2I.mjs → chunk-4BTFPFZR.mjs} +208 -221
- package/dist/development/{chunk-RGKEVI2W.mjs → chunk-CECIHG5K.mjs} +15 -5
- package/dist/development/{chunk-CYHICRRW.js → chunk-M4WLV5HP.js} +201 -258
- package/dist/development/{chunk-OLIKX45O.js → chunk-Z4R76DXJ.js} +7 -7
- package/dist/development/dom-export.d.mts +21 -2
- package/dist/development/dom-export.d.ts +21 -2
- package/dist/development/dom-export.js +158 -103
- package/dist/development/dom-export.mjs +133 -79
- package/dist/development/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{production/index-react-server-client-rcoGPJhU.d.mts → development/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- package/dist/development/index-react-server-client.d.mts +2 -2
- 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 +19 -4
- package/dist/development/index-react-server.d.ts +19 -4
- package/dist/development/index-react-server.js +30 -24
- package/dist/development/index-react-server.mjs +30 -24
- package/dist/development/index.d.mts +19 -15
- package/dist/development/index.d.ts +19 -15
- package/dist/development/index.js +92 -82
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-Unc20tLk.d.ts → development/instrumentation-Dwf-sTWa.d.ts} +66 -8
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/development/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/development/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/dist/production/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/production/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/production/{chunk-2DNJUQK6.js → chunk-55FFLVQP.js} +201 -258
- package/dist/production/{chunk-EDK3MRM6.js → chunk-5DTJHKF7.js} +167 -123
- package/dist/production/{chunk-LESYMMDQ.mjs → chunk-KJ5676BZ.mjs} +208 -221
- package/dist/production/{chunk-LC2OWLJG.mjs → chunk-QKAGOFED.mjs} +15 -5
- package/dist/production/{chunk-JLDESRHY.js → chunk-SGCRBGEM.js} +7 -7
- package/dist/production/dom-export.d.mts +21 -2
- package/dist/production/dom-export.d.ts +21 -2
- package/dist/production/dom-export.js +158 -103
- package/dist/production/dom-export.mjs +133 -79
- package/dist/production/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{development/index-react-server-client-rcoGPJhU.d.mts → production/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- package/dist/production/index-react-server-client.d.mts +2 -2
- 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 +19 -4
- package/dist/production/index-react-server.d.ts +19 -4
- package/dist/production/index-react-server.js +30 -24
- package/dist/production/index-react-server.mjs +30 -24
- package/dist/production/index.d.mts +19 -15
- package/dist/production/index.d.ts +19 -15
- package/dist/production/index.js +92 -82
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-Dwf-sTWa.d.ts} +66 -8
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/production/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/production/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.10.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
isSession,
|
|
29
29
|
routeRSCServerRequest,
|
|
30
30
|
setDevServerHooks
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QKAGOFED.mjs";
|
|
32
32
|
import {
|
|
33
33
|
Action,
|
|
34
34
|
Await,
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
withComponentProps,
|
|
140
140
|
withErrorBoundaryProps,
|
|
141
141
|
withHydrateFallbackProps
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-KJ5676BZ.mjs";
|
|
143
143
|
export {
|
|
144
144
|
Await,
|
|
145
145
|
BrowserRouter,
|
package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-Dwf-sTWa.d.ts}
RENAMED
|
@@ -541,6 +541,8 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
541
541
|
route: Promise<void> | undefined;
|
|
542
542
|
};
|
|
543
543
|
/**
|
|
544
|
+
* @deprecated Deprecated in favor of `shouldCallHandler`
|
|
545
|
+
*
|
|
544
546
|
* A boolean value indicating whether this route handler should be called in
|
|
545
547
|
* this pass.
|
|
546
548
|
*
|
|
@@ -566,8 +568,20 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
566
568
|
* custom `shouldRevalidate` implementations)
|
|
567
569
|
*/
|
|
568
570
|
shouldLoad: boolean;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Arguments passed to the `shouldRevalidate` function for this `loader` execution.
|
|
573
|
+
* Will be `null` if this is not a revalidating loader {@link DataStrategyMatch}.
|
|
574
|
+
*/
|
|
575
|
+
shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
576
|
+
/**
|
|
577
|
+
* Determine if this route's handler should be called during this `dataStrategy`
|
|
578
|
+
* execution. Calling it with no arguments will leverage the default revalidation
|
|
579
|
+
* behavior. You can pass your own `defaultShouldRevalidate` value if you wish
|
|
580
|
+
* to change the default revalidation behavior with your `dataStrategy`.
|
|
581
|
+
*
|
|
582
|
+
* @param defaultShouldRevalidate `defaultShouldRevalidate` override value (optional)
|
|
583
|
+
*/
|
|
584
|
+
shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
571
585
|
/**
|
|
572
586
|
* An async function that will resolve any `route.lazy` implementations and
|
|
573
587
|
* execute the route's handler (if necessary), returning a {@link DataStrategyResult}
|
|
@@ -1015,7 +1029,8 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1015
1029
|
/**
|
|
1016
1030
|
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
|
|
1017
1031
|
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
1018
|
-
* thrown from an [`action`](../../start/framework/route-module#action)
|
|
1032
|
+
* thrown from an [`action`](../../start/framework/route-module#action) or
|
|
1033
|
+
* [`loader`](../../start/framework/route-module#loader) function.
|
|
1019
1034
|
*
|
|
1020
1035
|
* @example
|
|
1021
1036
|
* import { isRouteErrorResponse } from "react-router";
|
|
@@ -1041,7 +1056,6 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1041
1056
|
* @mode data
|
|
1042
1057
|
* @param error The error to check.
|
|
1043
1058
|
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
|
|
1044
|
-
*
|
|
1045
1059
|
*/
|
|
1046
1060
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
1047
1061
|
|
|
@@ -1395,6 +1409,7 @@ type ViewTransitionOpts = {
|
|
|
1395
1409
|
interface RouterSubscriber {
|
|
1396
1410
|
(state: RouterState, opts: {
|
|
1397
1411
|
deletedFetchers: string[];
|
|
1412
|
+
newErrors: RouteData | null;
|
|
1398
1413
|
viewTransitionOpts?: ViewTransitionOpts;
|
|
1399
1414
|
flushSync: boolean;
|
|
1400
1415
|
}): void;
|
|
@@ -1743,6 +1758,7 @@ interface unstable_ClientOnErrorFunction {
|
|
|
1743
1758
|
(error: unknown, info: {
|
|
1744
1759
|
location: Location;
|
|
1745
1760
|
params: Params;
|
|
1761
|
+
unstable_pattern: string;
|
|
1746
1762
|
errorInfo?: React.ErrorInfo;
|
|
1747
1763
|
}): void;
|
|
1748
1764
|
}
|
|
@@ -1782,6 +1798,25 @@ interface RouterProviderProps {
|
|
|
1782
1798
|
* ```
|
|
1783
1799
|
*/
|
|
1784
1800
|
unstable_onError?: unstable_ClientOnErrorFunction;
|
|
1801
|
+
/**
|
|
1802
|
+
* Control whether router state updates are internally wrapped in
|
|
1803
|
+
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
1804
|
+
*
|
|
1805
|
+
* - When left `undefined`, all state updates are wrapped in
|
|
1806
|
+
* `React.startTransition`
|
|
1807
|
+
* - This can lead to buggy behaviors if you are wrapping your own
|
|
1808
|
+
* navigations/fetchers in `startTransition`.
|
|
1809
|
+
* - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
|
|
1810
|
+
* in `React.startTransition` and router state changes will be wrapped in
|
|
1811
|
+
* `React.startTransition` and also sent through
|
|
1812
|
+
* [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
|
|
1813
|
+
* surface mid-navigation router state changes to the UI.
|
|
1814
|
+
* - When set to `false`, the router will not leverage `React.startTransition` or
|
|
1815
|
+
* `React.useOptimistic` on any navigations or state changes.
|
|
1816
|
+
*
|
|
1817
|
+
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
|
1818
|
+
*/
|
|
1819
|
+
unstable_useTransitions?: boolean;
|
|
1785
1820
|
}
|
|
1786
1821
|
/**
|
|
1787
1822
|
* Render the UI for the given {@link DataRouter}. This component should
|
|
@@ -1812,9 +1847,10 @@ interface RouterProviderProps {
|
|
|
1812
1847
|
* @param {RouterProviderProps.flushSync} props.flushSync n/a
|
|
1813
1848
|
* @param {RouterProviderProps.unstable_onError} props.unstable_onError n/a
|
|
1814
1849
|
* @param {RouterProviderProps.router} props.router n/a
|
|
1850
|
+
* @param {RouterProviderProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
1815
1851
|
* @returns React element for the rendered router
|
|
1816
1852
|
*/
|
|
1817
|
-
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, unstable_onError, }: RouterProviderProps): React.ReactElement;
|
|
1853
|
+
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, unstable_onError, unstable_useTransitions, }: RouterProviderProps): React.ReactElement;
|
|
1818
1854
|
/**
|
|
1819
1855
|
* @category Types
|
|
1820
1856
|
*/
|
|
@@ -1835,6 +1871,21 @@ interface MemoryRouterProps {
|
|
|
1835
1871
|
* Index of `initialEntries` the application should initialize to
|
|
1836
1872
|
*/
|
|
1837
1873
|
initialIndex?: number;
|
|
1874
|
+
/**
|
|
1875
|
+
* Control whether router state updates are internally wrapped in
|
|
1876
|
+
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
1877
|
+
*
|
|
1878
|
+
* - When left `undefined`, all router state updates are wrapped in
|
|
1879
|
+
* `React.startTransition`
|
|
1880
|
+
* - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
|
|
1881
|
+
* in `React.startTransition` and all router state updates are wrapped in
|
|
1882
|
+
* `React.startTransition`
|
|
1883
|
+
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
1884
|
+
* on any navigations or state changes.
|
|
1885
|
+
*
|
|
1886
|
+
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
|
1887
|
+
*/
|
|
1888
|
+
unstable_useTransitions?: boolean;
|
|
1838
1889
|
}
|
|
1839
1890
|
/**
|
|
1840
1891
|
* A declarative {@link Router | `<Router>`} that stores all entries in memory.
|
|
@@ -1847,10 +1898,11 @@ interface MemoryRouterProps {
|
|
|
1847
1898
|
* @param {MemoryRouterProps.children} props.children n/a
|
|
1848
1899
|
* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
|
|
1849
1900
|
* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
|
|
1901
|
+
* @param {MemoryRouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
1850
1902
|
* @returns A declarative in-memory {@link Router | `<Router>`} for client-side
|
|
1851
1903
|
* routing.
|
|
1852
1904
|
*/
|
|
1853
|
-
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
|
|
1905
|
+
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, unstable_useTransitions, }: MemoryRouterProps): React.ReactElement;
|
|
1854
1906
|
/**
|
|
1855
1907
|
* @category Types
|
|
1856
1908
|
*/
|
|
@@ -2203,6 +2255,10 @@ interface RouterProps {
|
|
|
2203
2255
|
* will not be reactive to location changes.
|
|
2204
2256
|
*/
|
|
2205
2257
|
static?: boolean;
|
|
2258
|
+
/**
|
|
2259
|
+
* Whether this router should wrap navigations in `React.startTransition()`
|
|
2260
|
+
*/
|
|
2261
|
+
unstable_useTransitions: boolean;
|
|
2206
2262
|
}
|
|
2207
2263
|
/**
|
|
2208
2264
|
* Provides location context for the rest of the app.
|
|
@@ -2221,10 +2277,11 @@ interface RouterProps {
|
|
|
2221
2277
|
* @param {RouterProps.navigationType} props.navigationType n/a
|
|
2222
2278
|
* @param {RouterProps.navigator} props.navigator n/a
|
|
2223
2279
|
* @param {RouterProps.static} props.static n/a
|
|
2280
|
+
* @param {RouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
2224
2281
|
* @returns React element for the rendered router or `null` if the location does
|
|
2225
2282
|
* not match the {@link props.basename}
|
|
2226
2283
|
*/
|
|
2227
|
-
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
|
|
2284
|
+
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, unstable_useTransitions, }: RouterProps): React.ReactElement | null;
|
|
2228
2285
|
/**
|
|
2229
2286
|
* @category Types
|
|
2230
2287
|
*/
|
|
@@ -2568,7 +2625,7 @@ interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
|
|
|
2568
2625
|
}
|
|
2569
2626
|
type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
|
|
2570
2627
|
type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
|
|
2571
|
-
interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
|
|
2628
|
+
interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "unstable_useTransitions"> {
|
|
2572
2629
|
router: Router$1;
|
|
2573
2630
|
staticContext?: StaticHandlerContext;
|
|
2574
2631
|
unstable_onError?: unstable_ClientOnErrorFunction;
|
|
@@ -2622,6 +2679,7 @@ interface NavigationContextObject {
|
|
|
2622
2679
|
basename: string;
|
|
2623
2680
|
navigator: Navigator;
|
|
2624
2681
|
static: boolean;
|
|
2682
|
+
unstable_useTransitions: boolean;
|
|
2625
2683
|
future: {};
|
|
2626
2684
|
}
|
|
2627
2685
|
declare const NavigationContext: React.Context<NavigationContextObject>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-
|
|
1
|
+
import { R as RouteModule, h as LinkDescriptor, L as Location, F as Func, i as Pretty, j as MetaDescriptor, G as GetLoaderData, k as ServerDataFunctionArgs, l as MiddlewareNextFunction, m as ClientDataFunctionArgs, D as DataStrategyResult, n as ServerDataFrom, N as Normalize, o as GetActionData } from '../../router-Dgz_Mh9m.mjs';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-C97Jz2jB.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-
|
|
1
|
+
import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../instrumentation-Dwf-sTWa.js';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-BnQsYkwj.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteModule } from './instrumentation-
|
|
1
|
+
import { R as RouteModule } from './instrumentation-Dwf-sTWa.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
@@ -541,6 +541,8 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
541
541
|
route: Promise<void> | undefined;
|
|
542
542
|
};
|
|
543
543
|
/**
|
|
544
|
+
* @deprecated Deprecated in favor of `shouldCallHandler`
|
|
545
|
+
*
|
|
544
546
|
* A boolean value indicating whether this route handler should be called in
|
|
545
547
|
* this pass.
|
|
546
548
|
*
|
|
@@ -566,8 +568,20 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
566
568
|
* custom `shouldRevalidate` implementations)
|
|
567
569
|
*/
|
|
568
570
|
shouldLoad: boolean;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Arguments passed to the `shouldRevalidate` function for this `loader` execution.
|
|
573
|
+
* Will be `null` if this is not a revalidating loader {@link DataStrategyMatch}.
|
|
574
|
+
*/
|
|
575
|
+
shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
576
|
+
/**
|
|
577
|
+
* Determine if this route's handler should be called during this `dataStrategy`
|
|
578
|
+
* execution. Calling it with no arguments will leverage the default revalidation
|
|
579
|
+
* behavior. You can pass your own `defaultShouldRevalidate` value if you wish
|
|
580
|
+
* to change the default revalidation behavior with your `dataStrategy`.
|
|
581
|
+
*
|
|
582
|
+
* @param defaultShouldRevalidate `defaultShouldRevalidate` override value (optional)
|
|
583
|
+
*/
|
|
584
|
+
shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
571
585
|
/**
|
|
572
586
|
* An async function that will resolve any `route.lazy` implementations and
|
|
573
587
|
* execute the route's handler (if necessary), returning a {@link DataStrategyResult}
|
|
@@ -1015,7 +1029,8 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1015
1029
|
/**
|
|
1016
1030
|
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
|
|
1017
1031
|
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
1018
|
-
* thrown from an [`action`](../../start/framework/route-module#action)
|
|
1032
|
+
* thrown from an [`action`](../../start/framework/route-module#action) or
|
|
1033
|
+
* [`loader`](../../start/framework/route-module#loader) function.
|
|
1019
1034
|
*
|
|
1020
1035
|
* @example
|
|
1021
1036
|
* import { isRouteErrorResponse } from "react-router";
|
|
@@ -1041,7 +1056,6 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1041
1056
|
* @mode data
|
|
1042
1057
|
* @param error The error to check.
|
|
1043
1058
|
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
|
|
1044
|
-
*
|
|
1045
1059
|
*/
|
|
1046
1060
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
1047
1061
|
|
|
@@ -1181,6 +1195,7 @@ interface unstable_ClientOnErrorFunction {
|
|
|
1181
1195
|
(error: unknown, info: {
|
|
1182
1196
|
location: Location;
|
|
1183
1197
|
params: Params;
|
|
1198
|
+
unstable_pattern: string;
|
|
1184
1199
|
errorInfo?: React.ErrorInfo;
|
|
1185
1200
|
}): void;
|
|
1186
1201
|
}
|
|
@@ -1220,6 +1235,25 @@ interface RouterProviderProps {
|
|
|
1220
1235
|
* ```
|
|
1221
1236
|
*/
|
|
1222
1237
|
unstable_onError?: unstable_ClientOnErrorFunction;
|
|
1238
|
+
/**
|
|
1239
|
+
* Control whether router state updates are internally wrapped in
|
|
1240
|
+
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
1241
|
+
*
|
|
1242
|
+
* - When left `undefined`, all state updates are wrapped in
|
|
1243
|
+
* `React.startTransition`
|
|
1244
|
+
* - This can lead to buggy behaviors if you are wrapping your own
|
|
1245
|
+
* navigations/fetchers in `startTransition`.
|
|
1246
|
+
* - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
|
|
1247
|
+
* in `React.startTransition` and router state changes will be wrapped in
|
|
1248
|
+
* `React.startTransition` and also sent through
|
|
1249
|
+
* [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
|
|
1250
|
+
* surface mid-navigation router state changes to the UI.
|
|
1251
|
+
* - When set to `false`, the router will not leverage `React.startTransition` or
|
|
1252
|
+
* `React.useOptimistic` on any navigations or state changes.
|
|
1253
|
+
*
|
|
1254
|
+
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
|
1255
|
+
*/
|
|
1256
|
+
unstable_useTransitions?: boolean;
|
|
1223
1257
|
}
|
|
1224
1258
|
/**
|
|
1225
1259
|
* Render the UI for the given {@link DataRouter}. This component should
|
|
@@ -1250,9 +1284,10 @@ interface RouterProviderProps {
|
|
|
1250
1284
|
* @param {RouterProviderProps.flushSync} props.flushSync n/a
|
|
1251
1285
|
* @param {RouterProviderProps.unstable_onError} props.unstable_onError n/a
|
|
1252
1286
|
* @param {RouterProviderProps.router} props.router n/a
|
|
1287
|
+
* @param {RouterProviderProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
1253
1288
|
* @returns React element for the rendered router
|
|
1254
1289
|
*/
|
|
1255
|
-
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, unstable_onError, }: RouterProviderProps): React.ReactElement;
|
|
1290
|
+
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, unstable_onError, unstable_useTransitions, }: RouterProviderProps): React.ReactElement;
|
|
1256
1291
|
/**
|
|
1257
1292
|
* @category Types
|
|
1258
1293
|
*/
|
|
@@ -1273,6 +1308,21 @@ interface MemoryRouterProps {
|
|
|
1273
1308
|
* Index of `initialEntries` the application should initialize to
|
|
1274
1309
|
*/
|
|
1275
1310
|
initialIndex?: number;
|
|
1311
|
+
/**
|
|
1312
|
+
* Control whether router state updates are internally wrapped in
|
|
1313
|
+
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
1314
|
+
*
|
|
1315
|
+
* - When left `undefined`, all router state updates are wrapped in
|
|
1316
|
+
* `React.startTransition`
|
|
1317
|
+
* - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
|
|
1318
|
+
* in `React.startTransition` and all router state updates are wrapped in
|
|
1319
|
+
* `React.startTransition`
|
|
1320
|
+
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
1321
|
+
* on any navigations or state changes.
|
|
1322
|
+
*
|
|
1323
|
+
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
|
1324
|
+
*/
|
|
1325
|
+
unstable_useTransitions?: boolean;
|
|
1276
1326
|
}
|
|
1277
1327
|
/**
|
|
1278
1328
|
* A declarative {@link Router | `<Router>`} that stores all entries in memory.
|
|
@@ -1285,10 +1335,11 @@ interface MemoryRouterProps {
|
|
|
1285
1335
|
* @param {MemoryRouterProps.children} props.children n/a
|
|
1286
1336
|
* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
|
|
1287
1337
|
* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
|
|
1338
|
+
* @param {MemoryRouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
1288
1339
|
* @returns A declarative in-memory {@link Router | `<Router>`} for client-side
|
|
1289
1340
|
* routing.
|
|
1290
1341
|
*/
|
|
1291
|
-
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
|
|
1342
|
+
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, unstable_useTransitions, }: MemoryRouterProps): React.ReactElement;
|
|
1292
1343
|
/**
|
|
1293
1344
|
* @category Types
|
|
1294
1345
|
*/
|
|
@@ -1641,6 +1692,10 @@ interface RouterProps {
|
|
|
1641
1692
|
* will not be reactive to location changes.
|
|
1642
1693
|
*/
|
|
1643
1694
|
static?: boolean;
|
|
1695
|
+
/**
|
|
1696
|
+
* Whether this router should wrap navigations in `React.startTransition()`
|
|
1697
|
+
*/
|
|
1698
|
+
unstable_useTransitions: boolean;
|
|
1644
1699
|
}
|
|
1645
1700
|
/**
|
|
1646
1701
|
* Provides location context for the rest of the app.
|
|
@@ -1659,10 +1714,11 @@ interface RouterProps {
|
|
|
1659
1714
|
* @param {RouterProps.navigationType} props.navigationType n/a
|
|
1660
1715
|
* @param {RouterProps.navigator} props.navigator n/a
|
|
1661
1716
|
* @param {RouterProps.static} props.static n/a
|
|
1717
|
+
* @param {RouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
|
|
1662
1718
|
* @returns React element for the rendered router or `null` if the location does
|
|
1663
1719
|
* not match the {@link props.basename}
|
|
1664
1720
|
*/
|
|
1665
|
-
declare function Router$1({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
|
|
1721
|
+
declare function Router$1({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, unstable_useTransitions, }: RouterProps): React.ReactElement | null;
|
|
1666
1722
|
/**
|
|
1667
1723
|
* @category Types
|
|
1668
1724
|
*/
|
|
@@ -2006,7 +2062,7 @@ interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
|
|
|
2006
2062
|
}
|
|
2007
2063
|
type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
|
|
2008
2064
|
type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
|
|
2009
|
-
interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
|
|
2065
|
+
interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "unstable_useTransitions"> {
|
|
2010
2066
|
router: Router;
|
|
2011
2067
|
staticContext?: StaticHandlerContext;
|
|
2012
2068
|
unstable_onError?: unstable_ClientOnErrorFunction;
|
|
@@ -2060,6 +2116,7 @@ interface NavigationContextObject {
|
|
|
2060
2116
|
basename: string;
|
|
2061
2117
|
navigator: Navigator;
|
|
2062
2118
|
static: boolean;
|
|
2119
|
+
unstable_useTransitions: boolean;
|
|
2063
2120
|
future: {};
|
|
2064
2121
|
}
|
|
2065
2122
|
declare const NavigationContext: React.Context<NavigationContextObject>;
|
|
@@ -2966,6 +3023,7 @@ type ViewTransitionOpts = {
|
|
|
2966
3023
|
interface RouterSubscriber {
|
|
2967
3024
|
(state: RouterState, opts: {
|
|
2968
3025
|
deletedFetchers: string[];
|
|
3026
|
+
newErrors: RouteData | null;
|
|
2969
3027
|
viewTransitionOpts?: ViewTransitionOpts;
|
|
2970
3028
|
flushSync: boolean;
|
|
2971
3029
|
}): void;
|