react-router 0.0.0-experimental-dc307bdd5 → 0.0.0-experimental-d7bf770a8
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 +2 -13
- package/dist/index.d.ts +5 -4
- package/dist/index.js +38 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/deprecations.d.ts +4 -0
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +38 -7
- package/dist/react-router.development.js.map +1 -1
- package/dist/react-router.production.min.js +2 -2
- package/dist/react-router.production.min.js.map +1 -1
- package/dist/umd/react-router.development.js +38 -6
- package/dist/umd/react-router.development.js.map +1 -1
- package/dist/umd/react-router.production.min.js +2 -2
- package/dist/umd/react-router.production.min.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
-
## 6.26.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies:
|
|
8
|
-
- `@remix-run/router@1.19.0-pre.1`
|
|
9
|
-
|
|
10
|
-
## 6.26.0-pre.0
|
|
3
|
+
## 6.26.0
|
|
11
4
|
|
|
12
5
|
### Minor Changes
|
|
13
6
|
|
|
@@ -16,11 +9,9 @@
|
|
|
16
9
|
### Patch Changes
|
|
17
10
|
|
|
18
11
|
- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
|
|
19
|
-
|
|
20
12
|
- During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
|
|
21
|
-
|
|
22
13
|
- Updated dependencies:
|
|
23
|
-
- `@remix-run/router@1.19.0
|
|
14
|
+
- `@remix-run/router@1.19.0`
|
|
24
15
|
|
|
25
16
|
## 6.25.1
|
|
26
17
|
|
|
@@ -31,7 +22,6 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
31
22
|
### Minor Changes
|
|
32
23
|
|
|
33
24
|
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
|
|
34
|
-
|
|
35
25
|
- When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
|
|
36
26
|
- You may still opt-into revalidation via `shouldRevalidate`
|
|
37
27
|
- This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
|
|
@@ -55,7 +45,6 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
55
45
|
### Minor Changes
|
|
56
46
|
|
|
57
47
|
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
|
|
58
|
-
|
|
59
48
|
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
|
|
60
49
|
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router>
|
|
61
50
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult,
|
|
1
|
+
import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, unstable_AgnosticPatchRoutesOnNavigationFunction } from "@remix-run/router";
|
|
2
2
|
import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from "@remix-run/router";
|
|
3
3
|
import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components";
|
|
4
4
|
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches } from "./lib/components";
|
|
@@ -6,6 +6,7 @@ import type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions
|
|
|
6
6
|
import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
|
|
7
7
|
import type { NavigateFunction } from "./lib/hooks";
|
|
8
8
|
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteId, useRouteLoaderData, useRoutes, useRoutesImpl } from "./lib/hooks";
|
|
9
|
+
import { logV6DeprecationWarnings } from "./lib/deprecations";
|
|
9
10
|
type Hash = string;
|
|
10
11
|
type Pathname = string;
|
|
11
12
|
type Search = string;
|
|
@@ -14,7 +15,7 @@ export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Ou
|
|
|
14
15
|
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
15
16
|
hasErrorBoundary: boolean;
|
|
16
17
|
};
|
|
17
|
-
export interface
|
|
18
|
+
export interface unstable_PatchRoutesOnNavigationFunction extends unstable_AgnosticPatchRoutesOnNavigationFunction<RouteMatch> {
|
|
18
19
|
}
|
|
19
20
|
export declare function createMemoryRouter(routes: RouteObject[], opts?: {
|
|
20
21
|
basename?: string;
|
|
@@ -23,7 +24,7 @@ export declare function createMemoryRouter(routes: RouteObject[], opts?: {
|
|
|
23
24
|
initialEntries?: InitialEntry[];
|
|
24
25
|
initialIndex?: number;
|
|
25
26
|
unstable_dataStrategy?: unstable_DataStrategyFunction;
|
|
26
|
-
|
|
27
|
+
unstable_patchRoutesOnNavigation?: unstable_PatchRoutesOnNavigationFunction;
|
|
27
28
|
}): RemixRouter;
|
|
28
29
|
/** @internal */
|
|
29
|
-
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, };
|
|
30
|
+
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, logV6DeprecationWarnings as UNSAFE_logV6DeprecationWarnings, };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v0.0.0-experimental-
|
|
2
|
+
* React Router v0.0.0-experimental-d7bf770a8
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -551,7 +551,7 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
|
|
|
551
551
|
matches = dataRouterState.matches;
|
|
552
552
|
} else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
|
|
553
553
|
// Don't bail if we're initializing with partial hydration and we have
|
|
554
|
-
// router matches. That means we're actively running `
|
|
554
|
+
// router matches. That means we're actively running `patchRoutesOnNavigation`
|
|
555
555
|
// so we should render down the partial matches to the appropriate
|
|
556
556
|
// `HydrateFallback`. We only do this if `parentMatches` is empty so it
|
|
557
557
|
// only impacts the root matches for `RouterProvider` and no descendant
|
|
@@ -920,14 +920,43 @@ function useNavigateStable() {
|
|
|
920
920
|
}, [router, id]);
|
|
921
921
|
return navigate;
|
|
922
922
|
}
|
|
923
|
-
const alreadyWarned = {};
|
|
923
|
+
const alreadyWarned$1 = {};
|
|
924
924
|
function warningOnce(key, cond, message) {
|
|
925
|
-
if (!cond && !alreadyWarned[key]) {
|
|
926
|
-
alreadyWarned[key] = true;
|
|
925
|
+
if (!cond && !alreadyWarned$1[key]) {
|
|
926
|
+
alreadyWarned$1[key] = true;
|
|
927
927
|
process.env.NODE_ENV !== "production" ? UNSAFE_warning(false, message) : void 0;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
|
|
931
|
+
const alreadyWarned = {};
|
|
932
|
+
function warnOnce(key, message) {
|
|
933
|
+
if (!alreadyWarned[message]) {
|
|
934
|
+
alreadyWarned[message] = true;
|
|
935
|
+
console.warn(message);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
const logDeprecation = (flag, msg, link) => warnOnce(flag, "\u26A0\uFE0F Future Flag Warning: " + msg + ". " + ("You can use the `" + flag + "` future flag to opt-in early. ") + ("For more information, see " + link + "."));
|
|
939
|
+
function logV6DeprecationWarnings(future) {
|
|
940
|
+
if (future != null && future.v7_fetcherPersist) {
|
|
941
|
+
logDeprecation("v7_fetcherPersist", "The persistence behavior of fetchers is changing in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_fetcherpersist");
|
|
942
|
+
}
|
|
943
|
+
if (future != null && future.v7_normalizeFormMethod) {
|
|
944
|
+
logDeprecation("v7_normalizeFormMethod", "Casing of `formMethod` fields is being normalized to uppercase in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_normalizeformmethod");
|
|
945
|
+
}
|
|
946
|
+
if (future != null && future.v7_partialHydration) {
|
|
947
|
+
logDeprecation("v7_partialHydration", "RouterProvider hydration behavior is changing in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_partialhydration");
|
|
948
|
+
}
|
|
949
|
+
if (future != null && future.v7_relativeSplatPath) {
|
|
950
|
+
logDeprecation("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_relativesplatpath");
|
|
951
|
+
}
|
|
952
|
+
if (future != null && future.v7_skipActionErrorRevalidation) {
|
|
953
|
+
logDeprecation("v7_skipActionErrorRevalidation", "The revalidation behavior after 4xx/5xx action responses is changing in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_skipactionerrorrevalidation");
|
|
954
|
+
}
|
|
955
|
+
if (future != null && future.v7_startTransition) {
|
|
956
|
+
logDeprecation("v7_startTransition", "`RouterProvider` will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/en/v7/upgrading/future#v7_starttransition");
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
931
960
|
/**
|
|
932
961
|
Webpack + React 17 fails to compile on any of the following because webpack
|
|
933
962
|
complains that `startTransition` doesn't exist in `React`:
|
|
@@ -1070,6 +1099,7 @@ function MemoryRouter(_ref3) {
|
|
|
1070
1099
|
v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
|
|
1071
1100
|
}, [setStateImpl, v7_startTransition]);
|
|
1072
1101
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
1102
|
+
React.useEffect(() => logV6DeprecationWarnings(future), [future]);
|
|
1073
1103
|
return /*#__PURE__*/React.createElement(Router, {
|
|
1074
1104
|
basename: basename,
|
|
1075
1105
|
children: children,
|
|
@@ -1446,6 +1476,7 @@ function mapRouteProperties(route) {
|
|
|
1446
1476
|
return updates;
|
|
1447
1477
|
}
|
|
1448
1478
|
function createMemoryRouter(routes, opts) {
|
|
1479
|
+
logV6DeprecationWarnings(opts == null ? void 0 : opts.future);
|
|
1449
1480
|
return createRouter({
|
|
1450
1481
|
basename: opts == null ? void 0 : opts.basename,
|
|
1451
1482
|
future: _extends({}, opts == null ? void 0 : opts.future, {
|
|
@@ -1459,9 +1490,9 @@ function createMemoryRouter(routes, opts) {
|
|
|
1459
1490
|
routes,
|
|
1460
1491
|
mapRouteProperties,
|
|
1461
1492
|
unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
|
|
1462
|
-
|
|
1493
|
+
unstable_patchRoutesOnNavigation: opts == null ? void 0 : opts.unstable_patchRoutesOnNavigation
|
|
1463
1494
|
}).initialize();
|
|
1464
1495
|
}
|
|
1465
1496
|
|
|
1466
|
-
export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
1497
|
+
export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, logV6DeprecationWarnings as UNSAFE_logV6DeprecationWarnings, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
1467
1498
|
//# sourceMappingURL=index.js.map
|