react-router 0.0.0-experimental-8bb3ffdf → 0.0.0-experimental-114cf0b7

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,20 @@
1
1
  # `react-router`
2
2
 
3
+ ## 6.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `@remix-run/router@1.14.2`
9
+
10
+ ## 6.21.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
15
+ - Updated dependencies:
16
+ - `@remix-run/router@1.14.1`
17
+
3
18
  ## 6.21.0
4
19
 
5
20
  ### Minor Changes
@@ -108,7 +123,7 @@
108
123
  <BrowserRouter>
109
124
  <Routes>
110
125
  <Route path="dashboard">
111
- <Route path="*" element={<Dashboard />} />
126
+ <Route index path="*" element={<Dashboard />} />
112
127
  </Route>
113
128
  </Routes>
114
129
  </BrowserRouter>
@@ -145,7 +160,7 @@
145
160
 
146
161
  ### Patch Changes
147
162
 
148
- - Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
163
+ - Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
149
164
  - Updated dependencies:
150
165
  - `@remix-run/router@1.13.1`
151
166
 
@@ -173,6 +188,7 @@
173
188
  ### Patch Changes
174
189
 
175
190
  - Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree ([#11023](https://github.com/remix-run/react-router/pull/11023))
191
+
176
192
  - Fix bug in `useResolvedPath` that would cause `useResolvedPath(".")` in a splat route to lose the splat portion of the URL path. ([#10983](https://github.com/remix-run/react-router/pull/10983))
177
193
 
178
194
  - ⚠️ This fixes a quite long-standing bug specifically for `"."` paths inside a splat route which incorrectly dropped the splat portion of the URL. If you are relative routing via `"."` inside a splat route in your application you should double check that your logic is not relying on this buggy behavior and update accordingly.
@@ -285,7 +301,7 @@
285
301
 
286
302
  ## 6.12.1
287
303
 
288
- > [!WARNING]
304
+ > \[!WARNING]
289
305
  > Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.
290
306
 
291
307
  ### Patch Changes
@@ -617,7 +633,7 @@ function Comp() {
617
633
 
618
634
  ## 6.4.0
619
635
 
620
- Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
636
+ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
621
637
 
622
638
  **New APIs**
623
639
 
@@ -635,7 +651,3 @@ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs ov
635
651
  **Updated Dependencies**
636
652
 
637
653
  - `@remix-run/router@1.0.0`
638
-
639
- [rr-docs]: https://reactrouter.com
640
- [rr-feature-overview]: https://reactrouter.com/start/overview
641
- [rr-tutorial]: https://reactrouter.com/start/tutorial
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useIn
9
9
  type Hash = string;
10
10
  type Pathname = string;
11
11
  type Search = string;
12
- export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker as unstable_Blocker, BlockerFunction as unstable_BlockerFunction, };
12
+ export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, };
13
13
  export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, 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;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-8bb3ffdf
2
+ * React Router v0.0.0-experimental-114cf0b7
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -372,7 +372,26 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
372
372
  location = locationFromContext;
373
373
  }
374
374
  let pathname = location.pathname || "/";
375
- let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
375
+ let remainingPathname = pathname;
376
+ if (parentPathnameBase !== "/") {
377
+ // Determine the remaining pathname by removing the # of URL segments the
378
+ // parentPathnameBase has, instead of removing based on character count.
379
+ // This is because we can't guarantee that incoming/outgoing encodings/
380
+ // decodings will match exactly.
381
+ // We decode paths before matching on a per-segment basis with
382
+ // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they
383
+ // match what `window.location.pathname` would reflect. Those don't 100%
384
+ // align when it comes to encoded URI characters such as % and &.
385
+ //
386
+ // So we may end up with:
387
+ // pathname: "/descendant/a%25b/match"
388
+ // parentPathnameBase: "/descendant/a%b"
389
+ //
390
+ // And the direct substring removal approach won't work :/
391
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
392
+ let segments = pathname.replace(/^\//, "").split("/");
393
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
394
+ }
376
395
  let matches = matchRoutes(routes, {
377
396
  pathname: remainingPathname
378
397
  });