Skip to content

Commit 499af9a

Browse files
committed
Merge branch 'release-next' into dev
2 parents af41cda + 8be5e51 commit 499af9a

File tree

16 files changed

+144
-24
lines changed

16 files changed

+144
-24
lines changed

.changeset/fix-blocker-loop.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

contributors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
- GuptaSiddhant
7777
- haivuw
7878
- hernanif1
79+
- holynewbie
7980
- hongji00
8081
- hsbtr
8182
- hyesungoh
@@ -221,4 +222,3 @@
221222
- yionr
222223
- yuleicul
223224
- zheng-chuang
224-
- holynewbie

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
},
110110
"filesize": {
111111
"packages/router/dist/router.umd.min.js": {
112-
"none": "46.5 kB"
112+
"none": "46.6 kB"
113113
},
114114
"packages/react-router/dist/react-router.production.min.js": {
115115
"none": "13.8 kB"

packages/react-router-dom-v5-compat/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# `react-router-dom-v5-compat`
22

3+
## 6.14.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies:
8+
9+
10+
311
## 6.14.0
412

513
### Patch Changes

packages/react-router-dom-v5-compat/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-dom-v5-compat",
3-
"version": "6.14.0",
3+
"version": "6.14.1",
44
"description": "Migration path to React Router v6 from v4/5",
55
"keywords": [
66
"react",
@@ -24,7 +24,7 @@
2424
"types": "./dist/index.d.ts",
2525
"dependencies": {
2626
"history": "^5.3.0",
27-
"react-router": "6.14.0"
27+
"react-router": "6.14.1"
2828
},
2929
"peerDependencies": {
3030
"react": ">=16.8",

packages/react-router-dom/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# `react-router-dom`
22

3+
## 6.14.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies:
8+
9+
- `@remix-run/[email protected]`
10+
311
## 6.14.0
412

513
### Minor Changes

packages/react-router-dom/__tests__/use-blocker-test.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,77 @@ describe("navigation blocking with useBlocker", () => {
158158
act(() => root.unmount());
159159
});
160160

161+
it("handles reused blocker in a layout route", async () => {
162+
router = createMemoryRouter([
163+
{
164+
Component() {
165+
let blocker = useBlocker(true);
166+
return (
167+
<div>
168+
<Link to="/one">/one</Link>
169+
<Link to="/two">/two</Link>
170+
<Outlet />
171+
<p>{blocker.state}</p>
172+
{blocker.state === "blocked" ? (
173+
<button onClick={() => blocker.proceed?.()}>Proceed</button>
174+
) : null}
175+
</div>
176+
);
177+
},
178+
children: [
179+
{
180+
path: "/",
181+
element: <h1>Home</h1>,
182+
},
183+
{
184+
path: "/one",
185+
element: <h1>One</h1>,
186+
},
187+
{
188+
path: "/two",
189+
element: <h1>Two</h1>,
190+
},
191+
],
192+
},
193+
]);
194+
195+
act(() => {
196+
root = ReactDOM.createRoot(node);
197+
root.render(<RouterProvider router={router} />);
198+
});
199+
200+
// Start on /
201+
expect(node.querySelector("h1")?.textContent).toBe("Home");
202+
expect(node.querySelector("p")?.textContent).toBe("unblocked");
203+
expect(node.querySelector("button")).toBeNull();
204+
205+
// Blocked navigation to /one
206+
act(() => click(node.querySelector("a[href='/one']")));
207+
expect(node.querySelector("h1")?.textContent).toBe("Home");
208+
expect(node.querySelector("p")?.textContent).toBe("blocked");
209+
expect(node.querySelector("button")?.textContent).toBe("Proceed");
210+
211+
// Proceed to /one
212+
act(() => click(node.querySelector("button")));
213+
expect(node.querySelector("h1")?.textContent).toBe("One");
214+
expect(node.querySelector("p")?.textContent).toBe("unblocked");
215+
expect(node.querySelector("button")).toBeNull();
216+
217+
// Blocked navigation to /two
218+
act(() => click(node.querySelector("a[href='/two']")));
219+
expect(node.querySelector("h1")?.textContent).toBe("One");
220+
expect(node.querySelector("p")?.textContent).toBe("blocked");
221+
expect(node.querySelector("button")?.textContent).toBe("Proceed");
222+
223+
// Proceed to /two
224+
act(() => click(node.querySelector("button")));
225+
expect(node.querySelector("h1")?.textContent).toBe("Two");
226+
expect(node.querySelector("p")?.textContent).toBe("unblocked");
227+
expect(node.querySelector("button")).toBeNull();
228+
229+
act(() => root.unmount());
230+
});
231+
161232
describe("on <Link> navigation", () => {
162233
describe("blocker returns false", () => {
163234
beforeEach(() => {

packages/react-router-dom/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-dom",
3-
"version": "6.14.0",
3+
"version": "6.14.1",
44
"description": "Declarative routing for React web applications",
55
"keywords": [
66
"react",
@@ -23,8 +23,8 @@
2323
"module": "./dist/index.js",
2424
"types": "./dist/index.d.ts",
2525
"dependencies": {
26-
"@remix-run/router": "1.7.0",
27-
"react-router": "6.14.0"
26+
"@remix-run/router": "1.7.1",
27+
"react-router": "6.14.1"
2828
},
2929
"devDependencies": {
3030
"react": "^18.2.0",

packages/react-router-native/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# `react-router-native`
22

3+
## 6.14.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies:
8+
9+
10+
## 6.14.1-pre.1
11+
12+
### Patch Changes
13+
14+
- Updated dependencies:
15+
16+
17+
## 6.14.1-pre.0
18+
19+
### Patch Changes
20+
21+
- Updated dependencies:
22+
23+
324
## 6.14.0
425

526
### Patch Changes

packages/react-router-native/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-native",
3-
"version": "6.14.0",
3+
"version": "6.14.1",
44
"description": "Declarative routing for React Native applications",
55
"keywords": [
66
"react",
@@ -22,7 +22,7 @@
2222
"types": "./dist/index.d.ts",
2323
"dependencies": {
2424
"@ungap/url-search-params": "^0.1.4",
25-
"react-router": "6.14.0"
25+
"react-router": "6.14.1"
2626
},
2727
"devDependencies": {
2828
"react": "^18.2.0",

0 commit comments

Comments
 (0)