react-router-dom-v5-compat 6.26.2-pre.0 → 6.27.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 CHANGED
@@ -1,13 +1,22 @@
1
1
  # `react-router-dom-v5-compat`
2
2
 
3
- ## 6.26.2-pre.0
3
+ ## 6.27.0-pre.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies:
8
- - `@remix-run/router@1.19.2-pre.0`
9
- - `react-router@6.26.2-pre.0`
10
- - `react-router-dom@6.26.2-pre.0`
8
+ - `react-router-dom@6.27.0-pre.0`
9
+ - `react-router@6.27.0-pre.0`
10
+ - `@remix-run/router@1.20.0-pre.0`
11
+
12
+ ## 6.26.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies:
17
+ - `@remix-run/router@1.19.2`
18
+ - `react-router@6.26.2`
19
+ - `react-router-dom@6.26.2`
11
20
 
12
21
  ## 6.26.1
13
22
 
package/dist/index.d.ts CHANGED
@@ -46,7 +46,7 @@
46
46
  * would break. We could stop doing two bundles in v6 "react-router-dom" and
47
47
  * deprecate the deep require if we wanted to avoid the duplication here.
48
48
  */
49
- export type { ActionFunction, ActionFunctionArgs, AwaitProps, BrowserRouterProps, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, unstable_DataStrategyResult, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FetcherWithComponents, FormEncType, FormMethod, FormProps, FutureConfig, GetScrollRestorationKeyFunction, Hash, HashRouterProps, HistoryRouterProps, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LinkProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavLinkProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamKeyValuePair, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, ScrollRestorationProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, SubmitFunction, SubmitOptions, To, URLSearchParamsInit, UIMatch, Blocker, BlockerFunction, } from "./react-router-dom";
49
+ export type { ActionFunction, ActionFunctionArgs, AwaitProps, BrowserRouterProps, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FetcherWithComponents, FormEncType, FormMethod, FormProps, FutureConfig, GetScrollRestorationKeyFunction, Hash, HashRouterProps, HistoryRouterProps, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LinkProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavLinkProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamKeyValuePair, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, ScrollRestorationProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, SubmitFunction, SubmitOptions, To, URLSearchParamsInit, UIMatch, Blocker, BlockerFunction, } from "./react-router-dom";
50
50
  export { AbortedDeferredError, Await, BrowserRouter, Form, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, createSearchParams, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, renderMatches, resolvePath, unstable_HistoryRouter, useBlocker, unstable_usePrompt, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, } from "./react-router-dom";
51
51
  export type { StaticRouterProps } from "./lib/components";
52
52
  export { CompatRoute, CompatRouter, StaticRouter } from "./lib/components";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router DOM v5 Compat v6.26.2-pre.0
2
+ * React Router DOM v5 Compat v6.27.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -209,9 +209,9 @@ function getFormSubmissionInfo(target, basename) {
209
209
  };
210
210
  }
211
211
 
212
- const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"],
213
- _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "unstable_viewTransition", "children"],
214
- _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "unstable_viewTransition"];
212
+ const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"],
213
+ _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"],
214
+ _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"];
215
215
  // HEY YOU! DON'T TOUCH THIS VARIABLE!
216
216
  //
217
217
  // It is replaced with the proper version at build time via a babel plugin in
@@ -239,8 +239,8 @@ function createBrowserRouter(routes, opts) {
239
239
  hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
240
240
  routes,
241
241
  mapRouteProperties: UNSAFE_mapRouteProperties,
242
- unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
243
- unstable_patchRoutesOnNavigation: opts == null ? void 0 : opts.unstable_patchRoutesOnNavigation,
242
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
243
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,
244
244
  window: opts == null ? void 0 : opts.window
245
245
  }).initialize();
246
246
  }
@@ -256,8 +256,8 @@ function createHashRouter(routes, opts) {
256
256
  hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
257
257
  routes,
258
258
  mapRouteProperties: UNSAFE_mapRouteProperties,
259
- unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
260
- unstable_patchRoutesOnNavigation: opts == null ? void 0 : opts.unstable_patchRoutesOnNavigation,
259
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
260
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,
261
261
  window: opts == null ? void 0 : opts.window
262
262
  }).initialize();
263
263
  }
@@ -415,8 +415,8 @@ function RouterProvider(_ref) {
415
415
  let setState = React.useCallback((newState, _ref2) => {
416
416
  let {
417
417
  deletedFetchers,
418
- unstable_flushSync: flushSync,
419
- unstable_viewTransitionOpts: viewTransitionOpts
418
+ flushSync: flushSync,
419
+ viewTransitionOpts: viewTransitionOpts
420
420
  } = _ref2;
421
421
  deletedFetchers.forEach(key => fetcherData.current.delete(key));
422
422
  newState.fetchers.forEach((fetcher, key) => {
@@ -739,7 +739,7 @@ const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref7, ref) {
739
739
  target,
740
740
  to,
741
741
  preventScrollReset,
742
- unstable_viewTransition
742
+ viewTransition
743
743
  } = _ref7,
744
744
  rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
745
745
  let {
@@ -779,7 +779,7 @@ const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref7, ref) {
779
779
  target,
780
780
  preventScrollReset,
781
781
  relative,
782
- unstable_viewTransition
782
+ viewTransition
783
783
  });
784
784
  function handleClick(event) {
785
785
  if (onClick) onClick(event);
@@ -812,7 +812,7 @@ const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref
812
812
  end = false,
813
813
  style: styleProp,
814
814
  to,
815
- unstable_viewTransition,
815
+ viewTransition,
816
816
  children
817
817
  } = _ref8,
818
818
  rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
@@ -828,7 +828,7 @@ const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref
828
828
  let isTransitioning = routerState != null &&
829
829
  // Conditional usage is OK here because the usage of a data router is static
830
830
  // eslint-disable-next-line react-hooks/rules-of-hooks
831
- useViewTransitionState(path) && unstable_viewTransition === true;
831
+ useViewTransitionState(path) && viewTransition === true;
832
832
  let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
833
833
  let locationPathname = location.pathname;
834
834
  let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
@@ -872,7 +872,7 @@ const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref
872
872
  ref: ref,
873
873
  style: style,
874
874
  to: to,
875
- unstable_viewTransition: unstable_viewTransition
875
+ viewTransition: viewTransition
876
876
  }), typeof children === "function" ? children(renderProps) : children);
877
877
  });
878
878
  if (process.env.NODE_ENV !== "production") {
@@ -896,7 +896,7 @@ const Form = /*#__PURE__*/React.forwardRef((_ref9, forwardedRef) => {
896
896
  onSubmit,
897
897
  relative,
898
898
  preventScrollReset,
899
- unstable_viewTransition
899
+ viewTransition
900
900
  } = _ref9,
901
901
  props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
902
902
  let submit = useSubmit();
@@ -918,7 +918,7 @@ const Form = /*#__PURE__*/React.forwardRef((_ref9, forwardedRef) => {
918
918
  state,
919
919
  relative,
920
920
  preventScrollReset,
921
- unstable_viewTransition
921
+ viewTransition
922
922
  });
923
923
  };
924
924
  return /*#__PURE__*/React.createElement("form", _extends({
@@ -994,7 +994,7 @@ function useLinkClickHandler(to, _temp) {
994
994
  state,
995
995
  preventScrollReset,
996
996
  relative,
997
- unstable_viewTransition
997
+ viewTransition
998
998
  } = _temp === void 0 ? {} : _temp;
999
999
  let navigate = useNavigate();
1000
1000
  let location = useLocation();
@@ -1012,10 +1012,10 @@ function useLinkClickHandler(to, _temp) {
1012
1012
  state,
1013
1013
  preventScrollReset,
1014
1014
  relative,
1015
- unstable_viewTransition
1015
+ viewTransition
1016
1016
  });
1017
1017
  }
1018
- }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, unstable_viewTransition]);
1018
+ }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);
1019
1019
  }
1020
1020
  /**
1021
1021
  * A convenient wrapper for reading and writing search parameters via the
@@ -1078,7 +1078,7 @@ function useSubmit() {
1078
1078
  body,
1079
1079
  formMethod: options.method || method,
1080
1080
  formEncType: options.encType || encType,
1081
- unstable_flushSync: options.unstable_flushSync
1081
+ flushSync: options.flushSync
1082
1082
  });
1083
1083
  } else {
1084
1084
  router.navigate(options.action || action, {
@@ -1090,8 +1090,8 @@ function useSubmit() {
1090
1090
  replace: options.replace,
1091
1091
  state: options.state,
1092
1092
  fromRouteId: currentRouteId,
1093
- unstable_flushSync: options.unstable_flushSync,
1094
- unstable_viewTransition: options.unstable_viewTransition
1093
+ flushSync: options.flushSync,
1094
+ viewTransition: options.viewTransition
1095
1095
  });
1096
1096
  }
1097
1097
  }, [router, basename, currentRouteId]);
@@ -1125,9 +1125,13 @@ function useFormAction(action, _temp2) {
1125
1125
  // since it might not apply to our contextual route. We add it back based
1126
1126
  // on match.route.index below
1127
1127
  let params = new URLSearchParams(path.search);
1128
- if (params.has("index") && params.get("index") === "") {
1128
+ let indexValues = params.getAll("index");
1129
+ let hasNakedIndexParam = indexValues.some(v => v === "");
1130
+ if (hasNakedIndexParam) {
1129
1131
  params.delete("index");
1130
- path.search = params.toString() ? "?" + params.toString() : "";
1132
+ indexValues.filter(v => v).forEach(v => params.append("index", v));
1133
+ let qs = params.toString();
1134
+ path.search = qs ? "?" + qs : "";
1131
1135
  }
1132
1136
  }
1133
1137
  if ((!action || action === ".") && match.route.index) {
@@ -1418,7 +1422,7 @@ function useViewTransitionState(to, opts) {
1418
1422
  opts = {};
1419
1423
  }
1420
1424
  let vtContext = React.useContext(ViewTransitionContext);
1421
- !(vtContext != null) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. " + "Did you accidentally import `RouterProvider` from `react-router`?") : UNSAFE_invariant(false) : void 0;
1425
+ !(vtContext != null) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. " + "Did you accidentally import `RouterProvider` from `react-router`?") : UNSAFE_invariant(false) : void 0;
1422
1426
  let {
1423
1427
  basename
1424
1428
  } = useDataRouterContext(DataRouterHook.useViewTransitionState);
@@ -1434,11 +1438,11 @@ function useViewTransitionState(to, opts) {
1434
1438
  // destination. This ensures that other PUSH navigations that reverse
1435
1439
  // an indicated transition apply. I.e., on the list view you have:
1436
1440
  //
1437
- // <NavLink to="/details/1" unstable_viewTransition>
1441
+ // <NavLink to="/details/1" viewTransition>
1438
1442
  //
1439
1443
  // If you click the breadcrumb back to the list view:
1440
1444
  //
1441
- // <NavLink to="/list" unstable_viewTransition>
1445
+ // <NavLink to="/list" viewTransition>
1442
1446
  //
1443
1447
  // We should apply the transition because it's indicated as active going
1444
1448
  // from /list -> /details/1 and therefore should be active on the reverse