Skip to content

Commit 0079767

Browse files
committed
Merge branch 'dev' into release-next
2 parents e3ea0fe + 2cd8266 commit 0079767

38 files changed

+4781
-118
lines changed

.changeset/lazy-needles-shout.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router-dom": patch
3+
---
4+
5+
Added pass-through event listener options argument to `useBeforeUnload`

.changeset/light-phones-impress.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@remix-run/router": minor
3+
---
4+
5+
Added support for navigation blocking APIs

.changeset/violet-timers-type.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router-dom": minor
3+
---
4+
5+
Add `unstable_useBlocker` hook for blocking navigations within the app's location origin

.github/workflows/postrelease.yml

-17
This file was deleted.

.github/workflows/release.yml

+50-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
name: 🕊 Release
1+
name: 🦋 Changesets Release
22
on:
33
push:
44
branches:
55
- release
66
- "release-*"
77
- "!release-experimental"
88
- "!release-experimental-*"
9-
10-
concurrency: ${{ github.workflow }}-${{ github.ref }}
11-
12-
env:
13-
CI: true
9+
- "!release-manual"
10+
- "!release-manual-*"
1411

1512
jobs:
1613
release:
1714
name: 🦋 Changesets Release
1815
if: github.repository == 'remix-run/react-router'
1916
runs-on: ubuntu-latest
20-
17+
outputs:
18+
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
19+
published: ${{ steps.changesets.outputs.published }}
2120
steps:
21+
- name: 🛑 Cancel Previous Runs
22+
uses: styfle/cancel-workflow-action@0.11.0
23+
2224
- name: ⬇️ Checkout repo
2325
uses: actions/checkout@v3
2426
with:
2527
fetch-depth: 0
2628

27-
- name: ⎔ Setup Node
29+
- name: ⎔ Setup node
2830
uses: actions/setup-node@v3
2931
with:
3032
node-version-file: ".nvmrc"
31-
cache: yarn
33+
cache: "yarn"
3234

33-
- name: 📥 Install dependencies
34-
# even though this is called "npm-install" it does use yarn to install
35-
# because we have a yarn.lock and caches efficiently.
36-
uses: bahmutov/npm-install@v1
35+
- name: 📥 Install deps
36+
run: yarn --frozen-lockfile
3737

3838
- name: 🔐 Setup npm auth
3939
run: |
@@ -52,16 +52,45 @@ jobs:
5252
version: yarn run version
5353
commit: "chore: Update version for release"
5454
title: "chore: Update version for release"
55-
publish: yarn release
55+
publish: yarn run release
5656
createGithubReleases: false
5757
env:
5858
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN_SO_OTHER_ACTIONS_RUN }}
5959
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6060

61-
# comment:
62-
# needs: [release]
63-
# name: 📝 Comment on related issues and pull requests
64-
# if: github.repository == 'remix-run/react-router'
65-
# uses: remix-run/react-router/.github/workflows/release-comments.yml@main
66-
# with:
67-
# ref: ${{ github.ref }}
61+
findPackage:
62+
name: 🦋 Find Package
63+
needs: [release]
64+
runs-on: ubuntu-latest
65+
if: github.repository == 'remix-run/react-router' && needs.release.outputs.published == 'true'
66+
outputs:
67+
package: ${{ steps.findPackage.outputs.package }}
68+
steps:
69+
- name: 🛑 Cancel Previous Runs
70+
uses: styfle/cancel-workflow-action@0.11.0
71+
72+
- name: ⬇️ Checkout repo
73+
uses: actions/checkout@v3
74+
75+
- name: ⎔ Setup node
76+
uses: actions/setup-node@v3
77+
with:
78+
node-version: 16
79+
cache: "npm"
80+
81+
- id: findPackage
82+
run: |
83+
package=$(node ./scripts/release/find-release-from-changeset.js)
84+
echo "package=${package}" >> $GITHUB_OUTPUT
85+
env:
86+
packageVersionToFollow: "react-router"
87+
publishedPackages: ${{ needs.release.outputs.publishedPackages }}
88+
89+
comment:
90+
name: 📝 Comment on related issues and pull requests
91+
if: github.repository == 'remix-run/react-router' && needs.findPackage.outputs.package != ''
92+
needs: [release, findPackage]
93+
uses: ./.github/workflows/release-comments.yml
94+
with:
95+
ref: refs/tags/${{ needs.findPackage.outputs.package }}
96+
packageVersionToFollow: "react-router"

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ node_modules/
2222
/packages/react-router-dom-v5-compat/react-router-dom
2323

2424
.eslintcache
25-
/.env
25+
/.env
26+
/NOTES.md
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"installDependencies": true,
3+
"startCommand": "npm run dev"
4+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Navigation Blocking
3+
toc: false
4+
order: 1
5+
---
6+
7+
# Navigation Blocking
8+
9+
This example demonstrates using `unstable_useBlocker` to prevent navigating away from a page where you might lose user-entered form data. A potentially better UX for this is storing user-entered information in `sessionStorage` and pre-populating the form on return.
10+
11+
## Preview
12+
13+
Open this example on [StackBlitz](https://stackblitz.com):
14+
15+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router/tree/main/examples/navigation-blocking?file=src/App.tsx)
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>React Router - Navigation Blocking</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)