Skip to content

Commit 68b5b54

Browse files
committed
Update to unstable to follow OG process
1 parent b9c05f0 commit 68b5b54

File tree

7 files changed

+38
-32
lines changed

7 files changed

+38
-32
lines changed

.changeset/silly-worms-sleep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"react-router": minor
33
---
44

5-
Implement `<AbsoluteRoutes>`/`useAbsoluteRoutes` as alternatiuves to `<Routes>`/`useRoutes` when using absolute paths is required. This is primarily intended to be used to ease migrations from v5 applications where this was a common pattern. It's also useful for descendant routes when you want to manage your paths in an external data structure.
5+
Implement `<unstable_AbsoluteRoutes>`/`unstable_useAbsoluteRoutes` as alternatiuves to `<Routes>`/`useRoutes` when using absolute paths is required. This is primarily intended to be used to ease migrations from v5 applications where this was a common pattern. It's also useful for descendant routes when you want to manage your paths in an external data structure.

docs/api/components/AbsoluteRoutes.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
---
2-
title: AbsoluteRoutes
2+
title: unstable_AbsoluteRoutes
33
---
44

5-
# AbsoluteRoutes
5+
# unstable_AbsoluteRoutes
66

77
[MODES: framework, data, declarative]
88

99
## Summary
1010

11-
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.AbsoluteRoutes.html)
11+
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.unstable_AbsoluteRoutes.html)
1212

1313
An alternate version of [<Routes>](./Routes) that expects absolute paths on routes instead of relative paths. This is mostly intended to be used as a tool to help migrate from v5 where absolute paths were a common pattern, or for when you want to define your paths in a separate data structure using absolute paths.
1414

1515
```tsx
16-
import { AbsoluteRoutes, Route } from "react-router";
16+
import {
17+
unstable_AbsoluteRoutes,
18+
Route,
19+
} from "react-router";
1720

18-
<AbsoluteRoutes>
21+
<unstable_AbsoluteRoutes>
1922
<Route path="/dashboard/*" element={<Dashboard />} />
20-
</AbsoluteRoutes>;
23+
</unstable_AbsoluteRoutes>;
2124

2225
function Dashboard() {
2326
return (
24-
<AbsoluteRoutes>
27+
<unstable_AbsoluteRoutes>
2528
<Route
2629
path="/dashboard/settings"
2730
element={<Settings />}
2831
/>
2932
<Route path="/dashboard/users" element={<Users />} />
30-
</AbsoluteRoutes>
33+
</unstable_AbsoluteRoutes>
3134
);
3235
}
3336
```

docs/api/hooks/useAbsoluteRoutes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
2-
title: useAbsoluteRoutes
2+
title: unstable_useAbsoluteRoutes
33
---
44

5-
# useAbsoluteRoutes
5+
# unstable_useAbsoluteRoutes
66

77
[MODES: framework, data, declarative]
88

99
## Summary
1010

11-
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useAbsoluteRoutes.html)
11+
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.unstable_useAbsoluteRoutes.html)
1212

1313
An alternate version of [useRoutes](./useRoutes) that expects absolute paths on routes instead of relative paths. This is mostly intended to be used as a tool to help migrate from v5 where absolute paths were a common pattern, or for when you want to define your paths in a separate data structure using absolute paths. This hook expects absolute paths both when used at the top level of your application, or within a set of descendant routes inside a splat route.
1414

15-
The return value of `useAbsoluteRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
15+
The return value of `unstable_useAbsoluteRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
1616

1717
```tsx
1818
import * as React from "react";
19-
import { useAbsoluteRoutes } from "react-router";
19+
import { unstable_useAbsoluteRoutes } from "react-router";
2020

2121
const routes = {
2222
dashboard: {
@@ -34,7 +34,7 @@ const routes = {
3434
};
3535

3636
function App() {
37-
let element = useAbsoluteRoutes([
37+
let element = unstable_useAbsoluteRoutes([
3838
{
3939
path: routes.dashboard.path,
4040
element: <Dashboard />,
@@ -60,7 +60,7 @@ function App() {
6060
## Signature
6161

6262
```tsx
63-
useAbsoluteRoutes(routes, locationArg): undefined
63+
unstable_useAbsoluteRoutes(routes, locationArg): undefined
6464
```
6565

6666
## Params

packages/react-router/__tests__/absolute-routes-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as React from "react";
22
import * as TestRenderer from "react-test-renderer";
33
import {
4-
AbsoluteRoutes,
4+
unstable_AbsoluteRoutes as AbsoluteRoutes,
55
MemoryRouter,
66
Routes,
77
Route,
88
createRoutesFromElements,
9-
useAbsoluteRoutes,
9+
unstable_useAbsoluteRoutes as useAbsoluteRoutes,
1010
Outlet,
1111
} from "react-router";
1212

packages/react-router/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export type {
8989
RouteObject,
9090
} from "./lib/context";
9191
export type {
92-
AbsoluteRoutesProps,
92+
unstable_AbsoluteRoutesProps,
9393
AwaitProps,
9494
IndexRouteProps,
9595
LayoutRouteProps,
@@ -104,7 +104,7 @@ export type {
104104
RoutesProps,
105105
} from "./lib/components";
106106
export {
107-
AbsoluteRoutes,
107+
unstable_AbsoluteRoutes,
108108
Await,
109109
MemoryRouter,
110110
Navigate,
@@ -120,7 +120,7 @@ export {
120120
} from "./lib/components";
121121
export type { NavigateFunction } from "./lib/hooks";
122122
export {
123-
useAbsoluteRoutes,
123+
unstable_useAbsoluteRoutes,
124124
useBlocker,
125125
useActionData,
126126
useAsyncError,

packages/react-router/lib/components.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
} from "./context";
5454
import {
5555
_renderMatches,
56-
useAbsoluteRoutes,
56+
unstable_useAbsoluteRoutes,
5757
useActionData,
5858
useAsyncValue,
5959
useInRouterContext,
@@ -866,37 +866,40 @@ export function Routes({
866866
return useRoutes(createRoutesFromChildren(children), location);
867867
}
868868

869-
export interface AbsoluteRoutesProps extends RoutesProps {}
869+
export interface unstable_AbsoluteRoutesProps extends RoutesProps {}
870870

871871
/**
872872
* An alternate implementation of `<Routes>` that expects absolute paths even
873873
* when used as descendant routes. Note that these routes do not participate in
874874
* data loading, actions, code splitting, or any other route module features.
875875
*
876876
* ```tsx
877-
* import { AbsoluteRoutes, Route } from "react-router"
877+
* import { unstable_AbsoluteRoutes, Route } from "react-router"
878878
*
879-
* <AbsoluteRoutes>
879+
* <unstable_AbsoluteRoutes>
880880
* <Route path="/dashboard/*" element={<Dashboard />} />
881-
* </AbsoluteRoutes>
881+
* </unstable_AbsoluteRoutes>
882882
*
883883
* function Dashboard() {
884884
* return (
885-
* <AbsoluteRoutes>
885+
* <unstable_AbsoluteRoutes>
886886
* <Route path="/dashboard/settings" element={<Settings />} />
887887
* <Route path="/dashboard/users" element={<Users />} />
888-
* </AbsoluteRoutes>
888+
* </unstable_AbsoluteRoutes>
889889
* );
890890
* }
891891
* ```
892892
*
893893
* @category Components
894894
*/
895-
export function AbsoluteRoutes({
895+
export function unstable_AbsoluteRoutes({
896896
children,
897897
location,
898-
}: AbsoluteRoutesProps): React.ReactElement | null {
899-
return useAbsoluteRoutes(createRoutesFromChildren(children), location);
898+
}: unstable_AbsoluteRoutesProps): React.ReactElement | null {
899+
return unstable_useAbsoluteRoutes(
900+
createRoutesFromChildren(children),
901+
location
902+
);
900903
}
901904

902905
export interface AwaitResolveRenderFunction<Resolve = any> {

packages/react-router/lib/hooks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export function useRoutes(
431431
* remainder of the route tree. Route elements in the tree must render an
432432
* `<Outlet>` to render their child route's element.
433433
*/
434-
export function useAbsoluteRoutes(
434+
export function unstable_useAbsoluteRoutes(
435435
routes: RouteObject[],
436436
locationArg?: Partial<Location> | string
437437
): React.ReactElement | null {

0 commit comments

Comments
 (0)