Skip to content

Commit c5396bd

Browse files
committed
Merge branch 'main' into release-next
2 parents 509dd49 + 4a910ac commit c5396bd

28 files changed

+606
-59
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ body:
1111
- **All** bugs must have a **minimal** reproduction
1212
- Minimal means that it is not just pointing to a deployed site or a branch in your existing application
1313
- The preferred method is StackBlitz via [https://reactrouter.com/new](https://reactrouter.com/new)
14-
- If Stackblitz is not an option, a Github repo based on a fresh `create-react-router` app is acceptable
14+
- If Stackblitz is not an option, a GitHub repo based on a fresh `create-react-router` app is acceptable
1515
- Only in extraordinary circumstances will code snippets or maximal reproductions be accepted
1616
- Issue Review
1717
- Issues not meeting the above criteria will be closed and pointed to this document

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ jobs:
5151
# publish to npm.
5252
- name: 🚀 PR / Publish
5353
id: changesets
54-
uses: changesets/[email protected]
54+
# PLEASE KEEP THIS PINNED TO 1.4.10 to avoid a regression in 1.5.*
55+
# See https://github.com/changesets/action/issues/465
56+
uses: changesets/[email protected]
5557
with:
5658
version: pnpm run changeset:version
5759
commit: "chore: Update version for release"

GOVERNANCE.md

Lines changed: 32 additions & 32 deletions
Large diffs are not rendered by default.

contributors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
- haivuw
132132
- hampelm
133133
- harshmangalam
134+
- HenriqueLimas
134135
- hernanif1
135136
- HK-SHAO
136137
- holynewbie
@@ -189,6 +190,7 @@
189190
- ken0x0a
190191
- kentcdodds
191192
- kettanaito
193+
- kilavvy
192194
- kiliman
193195
- kkirsche
194196
- kno-raziel
@@ -399,6 +401,7 @@
399401
- yracnet
400402
- ytori
401403
- yuleicul
404+
- zeevick10
402405
- zeromask1337
403406
- zheng-chuang
404407
- zxTomw

decisions/0003-data-strategy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ We considered how to handle `shouldRevalidate` behavior. There's sort of 2 basic
141141

142142
I _think_ (1) is preferred to keep the API at a minimum and avoid leaking into _other_ ways to opt-out of revalidation. We already have an API for that so let's lean into it.
143143

144-
Additionally, another big con of (2) is that if we want to let them make revalidation decisions inside `dataStrategy` - we need to expose all of the informaiton required for that (`currentUrl`, `currentParams`, `nextUrl`, `nextParams`, `submission` info, `actionResult`, etc.) - the API becomes a mess.
144+
Additionally, another big con of (2) is that if we want to let them make revalidation decisions inside `dataStrategy` - we need to expose all of the information required for that (`currentUrl`, `currentParams`, `nextUrl`, `nextParams`, `submission` info, `actionResult`, etc.) - the API becomes a mess.
145145

146146
Therefore we are aiming to stick with one and let `shouldRevalidate` be the only way to opt-out of revalidation.
147147

decisions/0005-remixing-react-router.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function NewErrorBoundary() {
204204
const error = useRouteError();
205205

206206
if (error instanceof Response) {
207-
return <MyOldCatchBoudnary error={error} />;
207+
return <MyOldCatchBoundary error={error} />;
208208
} else {
209209
return <MyOldErrorBoundary error={error} />;
210210
}

docs/api/components/Await.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ via [useRouteError](../hooks/useRouteError) hook.
117117

118118
[modes: framework, data]
119119

120-
Takes a promise returned from a [LoaderFunction](../Other/LoaderFunction) value to be resolved and rendered.
120+
Takes a promise returned from a [LoaderFunction](https://api.reactrouter.com/v7/types/react_router.LoaderFunction.html) value to be resolved and rendered.
121121

122122
```jsx
123123
import { useLoaderData, Await } from "react-router";

docs/api/components/Link.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ This state is inaccessible on the server as it is implemented on top of [`histor
151151

152152
[modes: framework, data, declarative]
153153

154-
Can be a string or a partial [Path](../Other/Path):
154+
Can be a string or a partial [Path](https://api.reactrouter.com/v7/interfaces/react_router.Path.html):
155155

156156
```tsx
157157
<Link to="/some/path" />

docs/api/components/NavLink.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { NavLink } from "react-router";
2020
<NavLink to="/message" />;
2121
```
2222

23-
States are available through the className, style, and children render props. See [NavLinkRenderProps](../Other/NavLinkRenderProps).
23+
States are available through the className, style, and children render props. See [NavLinkRenderProps](https://api.reactrouter.com/v7/types/react_router.NavLinkRenderProps).
2424

2525
```tsx
2626
<NavLink
@@ -233,7 +233,7 @@ Note that `pending` is only available with Framework and Data modes.
233233

234234
[modes: framework, data, declarative]
235235

236-
Can be a string or a partial [Path](../Other/Path):
236+
Can be a string or a partial [Path](https://api.reactrouter.com/v7/interfaces/react_router.Path):
237237

238238
```tsx
239239
<Link to="/some/path" />

docs/api/hooks/useBlocker.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Allow the application to block navigations within the SPA and present the user a
1515
## Signature
1616

1717
```tsx
18-
useBlocker(shouldBlock): Blocker
18+
useBlocker(shouldBlock: boolean | BlockerFunction): Blocker
1919
```
2020

2121
## Params
@@ -24,7 +24,43 @@ useBlocker(shouldBlock): Blocker
2424

2525
[modes: framework, data]
2626

27-
_No documentation_
27+
**boolean**
28+
29+
Whether or not the navigation should be blocked. If `true`, the blocker will prevent the navigation. If `false`, the blocker will not prevent the navigation.
30+
31+
[**BlockerFunction**](https://api.reactrouter.com/v7/types/react_router.BlockerFunction.html)
32+
33+
A function that returns a boolean indicating whether the navigation should be blocked.
34+
35+
```tsx
36+
const blocker = useBlocker(
37+
({ currentLocation, nextLocation, historyAction }) =>
38+
value !== "" &&
39+
currentLocation.pathname !== nextLocation.pathname
40+
);
41+
```
42+
43+
## Blocker
44+
45+
The [Blocker](https://api.reactrouter.com/v7/types/react_router.Blocker.html) object returned by the hook. It has the following properties:
46+
47+
### `state`
48+
49+
- `unblocked` - the blocker is idle and has not prevented any navigation
50+
- `blocked` - the blocker has prevented a navigation
51+
- `proceeding` - the blocker is proceeding through from a blocked navigation
52+
53+
### `location`
54+
55+
When in a `blocked` state, this represents the [`Location`](https://api.reactrouter.com/v7/interfaces/react_router.Location.html) to which we blocked a navigation. When in a `proceeding` state, this is the location being navigated to after a `blocker.proceed()` call.
56+
57+
### `proceed()`
58+
59+
When in a `blocked` state, you may call `blocker.proceed()` to proceed to the blocked location.
60+
61+
### `reset()`
62+
63+
When in a `blocked` state, you may call `blocker.reset()` to return the blocker back to an `unblocked` state and leave the user at the current location.
2864

2965
## Examples
3066

0 commit comments

Comments
 (0)