diff --git a/.changeset/descendant-routes-component.md b/.changeset/descendant-routes-component.md deleted file mode 100644 index c4149968d9..0000000000 --- a/.changeset/descendant-routes-component.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router": patch ---- - -Fix usage of `Component` API within descendant `` diff --git a/.changeset/empty-path-basename-navigation.md b/.changeset/empty-path-basename-navigation.md deleted file mode 100644 index ff0d8e0c88..0000000000 --- a/.changeset/empty-path-basename-navigation.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -Fix basename handling when navigating without a path diff --git a/.changeset/navigate-from-routes.md b/.changeset/navigate-from-routes.md deleted file mode 100644 index 335f14b392..0000000000 --- a/.changeset/navigate-from-routes.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router": patch ---- - -Fix bug when calling `useNavigate` from `` inside a `` diff --git a/.changeset/navigate-strict-mode.md b/.changeset/navigate-strict-mode.md deleted file mode 100644 index e417ed415b..0000000000 --- a/.changeset/navigate-strict-mode.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router": patch ---- - -Fix usage of `` in strict mode when using a data router diff --git a/.changeset/same-hash-links.md b/.changeset/same-hash-links.md deleted file mode 100644 index 23d447a5c3..0000000000 --- a/.changeset/same-hash-links.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -"Same hash" navigations no longer re-run loaders to match browser behavior (i.e. `/path#hash -> /path#hash`) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 8639efb6b9..1edd87b4de 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -6,15 +6,16 @@ on: - main - dev +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: format: if: github.repository == 'remix-run/react-router' runs-on: ubuntu-latest steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 with: diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml index f64ea546be..45a3848fa2 100644 --- a/.github/workflows/no-response.yml +++ b/.github/workflows/no-response.yml @@ -17,25 +17,18 @@ jobs: - name: ๐Ÿฅบ Handle Ghosting uses: actions/stale@v8 with: + days-before-close: 10 close-issue-message: > - This issue has been automatically closed because we didn't hear - anything from the original author after the previous notice. + This issue has been automatically closed because we haven't received a + response from the original author ๐Ÿ™ˆ. This automation helps keep the issue + tracker clean from issues that aren't actionable. Please reach out if you + have more information for us! ๐Ÿ™‚ close-pr-message: > - This PR has been automatically closed because we didn't hear - anything from the original author after the previous notice. + This PR has been automatically closed because we haven't received a + response from the original author ๐Ÿ™ˆ. This automation helps keep the issue + tracker clean from PRs that aren't actionable. Please reach out if you + have more information for us! ๐Ÿ™‚ + # don't automatically mark issues/PRs as stale + days-before-stale: -1 stale-issue-label: needs-response - stale-issue-message: > - This issue has been automatically marked stale because we haven't - received a response from the original author in a while ๐Ÿ™ˆ. This - automation helps keep the issue tracker clean from issues that are - not actionable. Please reach out if you have more information for us - or you think this issue shouldn't be closed! ๐Ÿ™‚ If you don't do so - within 7 days, this issue will be automatically closed. stale-pr-label: needs-response - stale-pr-message: > - This PR has been automatically marked stale because we haven't - received a response from the original author in a while ๐Ÿ™ˆ. This - automation helps keep the issue tracker clean from issues that are - not actionable. Please reach out if you have more information for us - or you think this issue shouldn't be closed! ๐Ÿ™‚ If you don't do so - within 7 days, this PR will be automatically closed. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 388774fbe3..614994798a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,10 @@ on: - "!release-manual" - "!release-manual-*" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: release: name: ๐Ÿฆ‹ Changesets Release @@ -18,9 +22,6 @@ jobs: published_packages: ${{ steps.changesets.outputs.publishedPackages }} published: ${{ steps.changesets.outputs.published }} steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 with: @@ -66,9 +67,6 @@ jobs: outputs: package_version: ${{ steps.find_package_version.outputs.package_version }} steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d55f8d47f1..902966fd49 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,15 +15,16 @@ on: - "docs/**" - "**/*.md" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: name: ๐Ÿงช Test runs-on: ubuntu-latest steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 00a2614d27..bb26e96739 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -38,18 +38,19 @@ You may need to make changes to a pre-release prior to publishing a final stable ### Publishing the stable release - Exit Changesets pre-release mode: `yarn changeset pre exit`. -- Commit the deleted pre-release file along with any unpublished changesets, and push the the `release-*` branch to GitHub. +- Commit the edited pre-release file along with any unpublished changesets, and push the the `release-*` branch to GitHub. - Wait for the release workflow to finish. The Changesets action in the workflow will open a PR that will increment all versions and generate the changelogs for the stable release. - Review the updated `CHANGELOG` files and make any adjustments necessary. - We should remove the changelogs for all pre-releases ahead of publishing the stable version. - [TODO: We should automate this] +- Prepare the github release notes + - Copy the relevant changelog entries from all packages into the Release Notes and adjust accordingly, matching the format used by prior releases - Merge the PR into the `release-*` branch. - Once the PR is merged, the release workflow will publish the updated packages to npm. - Once the release is published: - merge the `release-*` branch into `main` and push it up to GitHub - merge the `release-*` branch into `dev` and push it up to GitHub - Convert the `react-router@6.x.y` tag to a Release on Github with the name `v6.x.y` - - Copy the relevant changelog entries from all packages into the Release Notes and adjust accordingly, matching the format used by prior releases ### Hotfix releases diff --git a/docs/routers/create-static-handler.md b/docs/routers/create-static-handler.md index 9895e6e3ca..fc60d18f3d 100644 --- a/docs/routers/create-static-handler.md +++ b/docs/routers/create-static-handler.md @@ -82,13 +82,52 @@ interface StaticHandler { These are the same `routes`/`basename` you would pass to [`createBrowserRouter`][createbrowserrouter] -## `handler.query(request)` +## `handler.query(request, opts)` The `handler.query()` method takes in a Fetch request, performs route matching, and executes all relevant route action/loader methods depending on the request. The return `context` value contains all of the information required to render the HTML document for the request (route-level `actionData`, `loaderData`, `errors`, etc.). If any of the matched routes return or throw a redirect response, then `query()` will return that redirect in the form of Fetch `Response`. -## `handler.queryRoute(request, routeId?)` +### `opts.requestContext` -The `handler.queryRoute` is a more-targeted version that queries a singular route and runs it's loader or action based on the request. You can specify a specific `routeId` or let it match the appropriate route automatically based on the request. The return value is the values returned from the loader or action, which is usually a `Response` object. +If you need to pass information from your server into Remix actions/loaders, you can do so with `opts.requestContext` and it will show up in your actions/loaders in the context parameter. + +```ts +const routes = [{ + path: '/', + loader({ request, context }) { + // Access `context.dataFormExpressMiddleware` here + }, +}]; + +export async function render(req: express.Request) { + let { query, dataRoutes } = createStaticHandler(routes); + let remixRequest = createFetchRequest(request); + let staticHandlerContext = await query(remixRequest, { + // Pass data from the express layer to the remix layer here + requestContext: { + dataFromExpressMiddleware: req.something + } + }); + ... +} +``` + +## `handler.queryRoute(request, opts)` + +The `handler.queryRoute` is a more-targeted version that queries a singular route and runs it's loader or action based on the request. By default, it will match the target route based on the request URL. The return value is the values returned from the loader or action, which is usually a `Response` object. + +### `opts.routeId` + +If you need to call a specific route action/loader that doesn't exactly correspond to the URL (for example, a parent route loader), you can specify a `routeId`: + +```js +staticHandler.queryRoute(new Request("/parent/child"), { + routeId: "parent", +}); +``` + +### `opts.requestContext` + +If you need to pass information from your server into Remix actions/loaders, you can do so with `opts.requestContext` and it will show up in your actions/loaders in the context parameter. See the example in the `query()` section above. **See also:** diff --git a/packages/react-router-dom-v5-compat/CHANGELOG.md b/packages/react-router-dom-v5-compat/CHANGELOG.md index b521e81bd5..71f9bdc515 100644 --- a/packages/react-router-dom-v5-compat/CHANGELOG.md +++ b/packages/react-router-dom-v5-compat/CHANGELOG.md @@ -1,5 +1,13 @@ # `react-router-dom-v5-compat` +## 6.11.1 + +### Patch Changes + +- Updated dependencies: + - `react-router@6.11.1` + - `react-router-dom@6.11.1` + ## 6.11.0 ### Patch Changes diff --git a/packages/react-router-dom-v5-compat/package.json b/packages/react-router-dom-v5-compat/package.json index 2f49ab041b..cdc2cca06a 100644 --- a/packages/react-router-dom-v5-compat/package.json +++ b/packages/react-router-dom-v5-compat/package.json @@ -1,6 +1,6 @@ { "name": "react-router-dom-v5-compat", - "version": "6.11.0", + "version": "6.11.1", "description": "Migration path to React Router v6 from v4/5", "keywords": [ "react", @@ -24,7 +24,7 @@ "types": "./dist/index.d.ts", "dependencies": { "history": "^5.3.0", - "react-router": "6.11.0" + "react-router": "6.11.1" }, "peerDependencies": { "react": ">=16.8", diff --git a/packages/react-router-dom/CHANGELOG.md b/packages/react-router-dom/CHANGELOG.md index 5b06df8660..c71900d061 100644 --- a/packages/react-router-dom/CHANGELOG.md +++ b/packages/react-router-dom/CHANGELOG.md @@ -1,5 +1,13 @@ # `react-router-dom` +## 6.11.1 + +### Patch Changes + +- Updated dependencies: + - `react-router@6.11.1` + - `@remix-run/router@1.6.1` + ## 6.11.0 ### Minor Changes diff --git a/packages/react-router-dom/package.json b/packages/react-router-dom/package.json index 59a560fcd4..e819a08afd 100644 --- a/packages/react-router-dom/package.json +++ b/packages/react-router-dom/package.json @@ -1,6 +1,6 @@ { "name": "react-router-dom", - "version": "6.11.0", + "version": "6.11.1", "description": "Declarative routing for React web applications", "keywords": [ "react", @@ -23,8 +23,8 @@ "module": "./dist/index.js", "types": "./dist/index.d.ts", "dependencies": { - "@remix-run/router": "1.6.0", - "react-router": "6.11.0" + "@remix-run/router": "1.6.1", + "react-router": "6.11.1" }, "devDependencies": { "react": "^18.2.0", diff --git a/packages/react-router-native/CHANGELOG.md b/packages/react-router-native/CHANGELOG.md index 0cfefb0371..144874eac0 100644 --- a/packages/react-router-native/CHANGELOG.md +++ b/packages/react-router-native/CHANGELOG.md @@ -1,5 +1,12 @@ # `react-router-native` +## 6.11.1 + +### Patch Changes + +- Updated dependencies: + - `react-router@6.11.1` + ## 6.11.0 ### Patch Changes diff --git a/packages/react-router-native/package.json b/packages/react-router-native/package.json index b8ac1eeef0..3c9cad156c 100644 --- a/packages/react-router-native/package.json +++ b/packages/react-router-native/package.json @@ -1,6 +1,6 @@ { "name": "react-router-native", - "version": "6.11.0", + "version": "6.11.1", "description": "Declarative routing for React Native applications", "keywords": [ "react", @@ -22,7 +22,7 @@ "types": "./dist/index.d.ts", "dependencies": { "@ungap/url-search-params": "^0.1.4", - "react-router": "6.11.0" + "react-router": "6.11.1" }, "devDependencies": { "react": "^18.2.0", diff --git a/packages/react-router/CHANGELOG.md b/packages/react-router/CHANGELOG.md index 6fb8511f62..c5c8b1f314 100644 --- a/packages/react-router/CHANGELOG.md +++ b/packages/react-router/CHANGELOG.md @@ -1,5 +1,15 @@ # `react-router` +## 6.11.1 + +### Patch Changes + +- Fix usage of `Component` API within descendant `` ([#10434](https://github.com/remix-run/react-router/pull/10434)) +- Fix bug when calling `useNavigate` from `` inside a `` ([#10432](https://github.com/remix-run/react-router/pull/10432)) +- Fix usage of `` in strict mode when using a data router ([#10435](https://github.com/remix-run/react-router/pull/10435)) +- Updated dependencies: + - `@remix-run/router@1.6.1` + ## 6.11.0 ### Patch Changes diff --git a/packages/react-router/package.json b/packages/react-router/package.json index c822c3b6a4..9996761865 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -1,6 +1,6 @@ { "name": "react-router", - "version": "6.11.0", + "version": "6.11.1", "description": "Declarative routing for React", "keywords": [ "react", @@ -23,7 +23,7 @@ "module": "./dist/index.js", "types": "./dist/index.d.ts", "dependencies": { - "@remix-run/router": "1.6.0" + "@remix-run/router": "1.6.1" }, "devDependencies": { "react": "^18.2.0" diff --git a/packages/router/CHANGELOG.md b/packages/router/CHANGELOG.md index 8d182c203e..d8aaa9dee3 100644 --- a/packages/router/CHANGELOG.md +++ b/packages/router/CHANGELOG.md @@ -1,5 +1,12 @@ # `@remix-run/router` +## 1.6.1 + +### Patch Changes + +- Fix `basename` handling when navigating without a path ([#10433](https://github.com/remix-run/react-router/pull/10433)) +- "Same hash" navigations no longer re-run loaders to match browser behavior (i.e. `/path#hash -> /path#hash`) ([#10408](https://github.com/remix-run/react-router/pull/10408)) + ## 1.6.0 ### Minor Changes diff --git a/packages/router/package.json b/packages/router/package.json index a2ba2e01bf..ccf411ce05 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -1,6 +1,6 @@ { "name": "@remix-run/router", - "version": "1.6.0", + "version": "1.6.1", "description": "Nested/Data-driven/Framework-agnostic Routing", "keywords": [ "remix",