react-router 6.9.0 → 6.10.0-pre.1

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,31 @@
1
1
  # `react-router`
2
2
 
3
+ ## 6.10.0-pre.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `@remix-run/router@1.5.0-pre.1`
9
+
10
+ ## 6.10.0-pre.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Added support for [**Future Flags**](https://reactrouter.com/en/main/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
15
+
16
+ - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
17
+ - `useNavigation().formMethod` is lowercase
18
+ - `useFetcher().formMethod` is lowercase
19
+ - When `future.v7_normalizeFormMethod === true`:
20
+ - `useNavigation().formMethod` is uppercase
21
+ - `useFetcher().formMethod` is uppercase
22
+
23
+ ### Patch Changes
24
+
25
+ - Fix route ID generation when using Fragments in `createRoutesFromElements` ([#10193](https://github.com/remix-run/react-router/pull/10193))
26
+ - Updated dependencies:
27
+ - `@remix-run/router@1.5.0-pre.0`
28
+
3
29
  ## 6.9.0
4
30
 
5
31
  ### Minor Changes
@@ -105,8 +131,8 @@
105
131
 
106
132
  ### Patch Changes
107
133
 
108
- - Fix `generatePath` incorrectly applying parameters in some cases ([`bc6fefa1`](https://github.com/remix-run/react-router/commit/bc6fefa19019ce9f5250c8b5af9b8c5d3390e9d1))
109
- - Improve memoization for context providers to avoid unnecessary re-renders ([`bc6fefa1`](https://github.com/remix-run/react-router/commit/bc6fefa19019ce9f5250c8b5af9b8c5d3390e9d1))
134
+ - Fix `generatePath` incorrectly applying parameters in some cases ([#10078](https://github.com/remix-run/react-router/pull/10078))
135
+ - Improve memoization for context providers to avoid unnecessary re-renders ([#9983](https://github.com/remix-run/react-router/pull/9983))
110
136
 
111
137
  ## 6.8.2
112
138
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, Fetcher, HydrationState, JsonFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, Params, ParamParseKey, Path, PathMatch, PathPattern, RedirectFunction, Router as RemixRouter, ShouldRevalidateFunction, To, InitialEntry, LazyRouteFunction } from "@remix-run/router";
1
+ import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, Fetcher, HydrationState, JsonFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, Params, ParamParseKey, Path, PathMatch, PathPattern, RedirectFunction, Router as RemixRouter, ShouldRevalidateFunction, To, InitialEntry, LazyRouteFunction, FutureConfig } from "@remix-run/router";
2
2
  import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from "@remix-run/router";
3
3
  import type { AwaitProps, MemoryRouterProps, NavigateProps, OutletProps, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps, RouterProviderProps } from "./lib/components";
4
4
  import { createRoutesFromChildren, renderMatches, Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes } from "./lib/components";
@@ -14,6 +14,7 @@ export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Ou
14
14
  declare function detectErrorBoundary(route: RouteObject): boolean;
15
15
  export declare function createMemoryRouter(routes: RouteObject[], opts?: {
16
16
  basename?: string;
17
+ future?: FutureConfig;
17
18
  hydrationData?: HydrationState;
18
19
  initialEntries?: InitialEntry[];
19
20
  initialIndex?: number;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.9.0
2
+ * React Router v6.10.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1350,15 +1350,16 @@ function createRoutesFromChildren(children, parentPath) {
1350
1350
  return;
1351
1351
  }
1352
1352
 
1353
+ let treePath = [...parentPath, index];
1354
+
1353
1355
  if (element.type === React.Fragment) {
1354
1356
  // Transparently support React.Fragment and its children.
1355
- routes.push.apply(routes, createRoutesFromChildren(element.props.children, parentPath));
1357
+ routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));
1356
1358
  return;
1357
1359
  }
1358
1360
 
1359
1361
  !(element.type === Route) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : UNSAFE_invariant(false) : void 0;
1360
1362
  !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "An index route cannot have child routes.") : UNSAFE_invariant(false) : void 0;
1361
- let treePath = [...parentPath, index];
1362
1363
  let route = {
1363
1364
  id: element.props.id || treePath.join("-"),
1364
1365
  caseSensitive: element.props.caseSensitive,
@@ -1411,6 +1412,7 @@ function detectErrorBoundary(route) {
1411
1412
  function createMemoryRouter(routes, opts) {
1412
1413
  return createRouter({
1413
1414
  basename: opts == null ? void 0 : opts.basename,
1415
+ future: opts == null ? void 0 : opts.future,
1414
1416
  history: createMemoryHistory({
1415
1417
  initialEntries: opts == null ? void 0 : opts.initialEntries,
1416
1418
  initialIndex: opts == null ? void 0 : opts.initialIndex