react-router 6.14.2 → 6.15.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # `react-router`
2
2
 
3
+ ## 6.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add's a new `redirectDocument()` function which allows users to specify that a redirect from a `loader`/`action` should trigger a document reload (via `window.location`) instead of attempting to navigate to the redirected location via React Router ([#10705](https://github.com/remix-run/react-router/pull/10705))
8
+
9
+ ### Patch Changes
10
+
11
+ - Ensure `useRevalidator` is referentially stable across re-renders if revalidations are not actively occurring ([#10707](https://github.com/remix-run/react-router/pull/10707))
12
+ - Updated dependencies:
13
+ - `@remix-run/router@1.8.0`
14
+
3
15
  ## 6.14.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, Fetcher, HydrationState, JsonFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, Params, ParamParseKey, Path, PathMatch, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, ShouldRevalidateFunction, To, InitialEntry, LazyRouteFunction, FutureConfig as RouterFutureConfig } from "@remix-run/router";
2
- import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from "@remix-run/router";
2
+ import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from "@remix-run/router";
3
3
  import type { AwaitProps, MemoryRouterProps, NavigateProps, OutletProps, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps, RouterProviderProps, FutureConfig } from "./lib/components";
4
4
  import { createRoutesFromChildren, renderMatches, Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes } from "./lib/components";
5
5
  import type { DataRouteMatch, DataRouteObject, IndexRouteObject, Navigator, NavigateOptions, NonIndexRouteObject, RouteMatch, RouteObject } from "./lib/context";
@@ -10,7 +10,7 @@ type Hash = string;
10
10
  type Pathname = string;
11
11
  type Search = string;
12
12
  export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker as unstable_Blocker, BlockerFunction as unstable_BlockerFunction, DataRouteMatch, DataRouteObject, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To, };
13
- export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker as unstable_useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
13
+ export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker as unstable_useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
14
14
  declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
15
15
  hasErrorBoundary: boolean;
16
16
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.14.2
2
+ * React Router v6.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import * as React from 'react';
12
12
  import { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';
13
- export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';
13
+ export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from '@remix-run/router';
14
14
 
15
15
  function _extends() {
16
16
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -585,14 +585,13 @@ function _renderMatches(matches, parentMatches, dataRouterState) {
585
585
  }) : getChildren();
586
586
  }, null);
587
587
  }
588
- var DataRouterHook;
589
- (function (DataRouterHook) {
588
+ var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
590
589
  DataRouterHook["UseBlocker"] = "useBlocker";
591
590
  DataRouterHook["UseRevalidator"] = "useRevalidator";
592
591
  DataRouterHook["UseNavigateStable"] = "useNavigate";
593
- })(DataRouterHook || (DataRouterHook = {}));
594
- var DataRouterStateHook;
595
- (function (DataRouterStateHook) {
592
+ return DataRouterHook;
593
+ }(DataRouterHook || {});
594
+ var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
596
595
  DataRouterStateHook["UseBlocker"] = "useBlocker";
597
596
  DataRouterStateHook["UseLoaderData"] = "useLoaderData";
598
597
  DataRouterStateHook["UseActionData"] = "useActionData";
@@ -603,7 +602,8 @@ var DataRouterStateHook;
603
602
  DataRouterStateHook["UseRevalidator"] = "useRevalidator";
604
603
  DataRouterStateHook["UseNavigateStable"] = "useNavigate";
605
604
  DataRouterStateHook["UseRouteId"] = "useRouteId";
606
- })(DataRouterStateHook || (DataRouterStateHook = {}));
605
+ return DataRouterStateHook;
606
+ }(DataRouterStateHook || {});
607
607
  function getDataRouterConsoleError(hookName) {
608
608
  return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
609
609
  }
@@ -654,10 +654,10 @@ function useNavigation() {
654
654
  function useRevalidator() {
655
655
  let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
656
656
  let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
657
- return {
657
+ return React.useMemo(() => ({
658
658
  revalidate: dataRouterContext.router.revalidate,
659
659
  state: state.revalidation
660
- };
660
+ }), [dataRouterContext.router.revalidate, state.revalidation]);
661
661
  }
662
662
 
663
663
  /**
@@ -1142,12 +1142,12 @@ function Await(_ref7) {
1142
1142
  errorElement: errorElement
1143
1143
  }, /*#__PURE__*/React.createElement(ResolveAwait, null, children));
1144
1144
  }
1145
- var AwaitRenderStatus;
1146
- (function (AwaitRenderStatus) {
1145
+ var AwaitRenderStatus = /*#__PURE__*/function (AwaitRenderStatus) {
1147
1146
  AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1148
1147
  AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1149
1148
  AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1150
- })(AwaitRenderStatus || (AwaitRenderStatus = {}));
1149
+ return AwaitRenderStatus;
1150
+ }(AwaitRenderStatus || {});
1151
1151
  const neverSettledPromise = new Promise(() => {});
1152
1152
  class AwaitErrorBoundary extends React.Component {
1153
1153
  constructor(props) {