Skip to content

Commit 6f313ec

Browse files
committed
Merge branch 'main' into release-next
2 parents d12031c + e01a4d7 commit 6f313ec

39 files changed

+162
-593
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,65 @@
11
name: 🐛 Bug Report
22
description: Something is wrong with React Router
3-
title: "[Bug]: "
43
labels:
54
- bug
65
body:
76
- type: markdown
87
attributes:
98
value: |
10-
Thank you for contributing!
9+
Thank you for helping to improve React Router!
1110
12-
Do you need some help?
13-
======================
14-
The issue tracker is meant for bug reports only. This isn't the best place for support
15-
or usage questions. Questions here don't have as much visibility as they do elsewhere.
16-
Before you ask a question, here are some resources to get help first:
11+
## Option 1: Submit a PR with a failing test
1712
18-
- Read the docs: https://reactrouter.com
19-
- Check out the list of frequently asked questions: https://reactrouter.com/main/start/faq
20-
- Explore examples: https://reactrouter.com/main/start/examples
21-
- Ask in chat: https://rmx.as/discord
22-
- Look for/ask questions on Stack Overflow: https://stackoverflow.com/questions/tagged/react-router
13+
🏆 The most helpful reproduction is to use our _bug report integration test_ template:
2314
24-
### Test Case Starters:
15+
1. [Fork `remix-run/react-router`](https://github.com/remix-run/react-router/fork)
16+
2. Open [`integration/bug-report-test.ts`](https://github.com/remix-run/react-router/blob/dev/integration/bug-report-test.ts) in your editor
17+
3. Follow the instructions and submit a pull request with a failing bug report test!
2518
26-
* [Using `<RouterProvider>`](https://stackblitz.com/github/remix-run/react-router/tree/main/examples/basic-data-router?file=src/app.tsx)
27-
* [Using `<BrowserRouter>`](https://stackblitz.com/github/remix-run/react-router/tree/main/examples/basic?file=src/App.tsx)
28-
- type: input
19+
## Option 2: Continue filling out this form
20+
21+
If you'd rather open a GitHub issue, here are other ways to share a reproduction (ordered from most helpful to least):
22+
23+
- 🥇 Link to a [StackBlitz](https://remix.new) environment
24+
- 🥈 Link to a GitHub repository
25+
- 🥉 Description of project including template, config files, `package.json` scripts, etc.
26+
27+
- type: dropdown
28+
id: mode
29+
attributes:
30+
label: I'm using React Router as a...
31+
description: See https://reactrouter.com/home for explanation
32+
options:
33+
- library
34+
- framework
35+
validations:
36+
required: true
37+
- type: textarea
38+
id: reproduction
2939
attributes:
30-
label: What version of React Router are you using?
40+
label: Reproduction
41+
description: Link to reproduction and steps to reproduce the behavior
42+
placeholder: Go to https://stackblitz.com/edit/... and click the "Submit" button
3143
validations:
3244
required: true
3345
- type: textarea
46+
id: system-info
47+
attributes:
48+
label: System Info
49+
description: Output of `npx envinfo --system --npmPackages '{vite,react-router,@react-router/*}' --binaries --browsers`
50+
render: shell
51+
placeholder: System, Binaries, Browsers
52+
validations:
53+
required: true
54+
- type: dropdown
55+
id: package-manager
3456
attributes:
35-
label: Steps to Reproduce
36-
description: Steps to reproduce the behavior.
57+
label: Used Package Manager
58+
description: Select the used package manager
59+
options:
60+
- npm
61+
- yarn
62+
- pnpm
3763
validations:
3864
required: true
3965
- type: textarea

CHANGELOG.md

Lines changed: 14 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ We manage release notes in this file instead of the paginated Github Releases Pa
2525
- [Other Notable Changes](#other-notable-changes)
2626
- [`routes.ts`](#routests)
2727
- [Typesafety improvements](#typesafety-improvements)
28-
- [Setup](#setup)
29-
- [`typegen` command](#typegen-command)
30-
- [TypeScript plugin](#typescript-plugin)
31-
- [VSCode](#vscode)
32-
- [Troubleshooting](#troubleshooting)
3328
- [Prerendering](#prerendering)
3429
- [Major Changes (`react-router`)](#major-changes-react-router)
3530
- [Major Changes (`@react-router/*`)](#major-changes-react-router-1)
@@ -334,29 +329,26 @@ For Remix consumers migrating to React Router, the `vitePlugin` and `cloudflareD
334329
+import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";
335330
```
336331

337-
**Removed Vite Plugin `manifest` option**
332+
**Removed `manifest` option**
338333

339334
For Remix consumers migrating to React Router, the Vite plugin's `manifest` option has been removed. The `manifest` option been superseded by the more powerful `buildEnd` hook since it's passed the `buildManifest` argument. You can still write the build manifest to disk if needed, but you'll most likely find it more convenient to write any logic depending on the build manifest within the `buildEnd` hook itself. ([#11573](https://github.com/remix-run/react-router/pull/11573))
340335

341336
If you were using the `manifest` option, you can replace it with a `buildEnd` hook that writes the manifest to disk like this:
342337

343338
```js
344-
import { reactRouter } from "@react-router/dev/vite";
339+
// react-router.config.ts
340+
import { type Config } from "@react-router/dev/config";
345341
import { writeFile } from "node:fs/promises";
346342

347343
export default {
348-
plugins: [
349-
reactRouter({
350-
async buildEnd({ buildManifest }) {
351-
await writeFile(
352-
"build/manifest.json",
353-
JSON.stringify(buildManifest, null, 2),
354-
"utf-8"
355-
);
356-
},
357-
}),
358-
],
359-
};
344+
async buildEnd({ buildManifest }) {
345+
await writeFile(
346+
"build/manifest.json",
347+
JSON.stringify(buildManifest, null, 2),
348+
"utf-8"
349+
);
350+
},
351+
} satisfies Config;
360352
```
361353

362354
#### Exposed Router Promises
@@ -470,131 +462,9 @@ Also note that, if you were using Remix's `routes` option to define config-based
470462

471463
#### Typesafety improvements
472464

473-
React Router now generates types for each of your route modules and passes typed props to route module component exports ([#11961](https://github.com/remix-run/react-router/pull/11961), [#12019](https://github.com/remix-run/react-router/pull/12019)). You can access those types by importing them from `./+types.<route filename without extension>`.
474-
475-
For example:
476-
477-
```ts
478-
// app/routes/product.tsx
479-
import type * as Route from "./+types.product";
480-
481-
export function loader({ params }: Route.LoaderArgs) {}
482-
483-
export default function Component({ loaderData }: Route.ComponentProps) {}
484-
```
485-
486-
This initial implementation targets type inference for:
487-
488-
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
489-
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
490-
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
491-
492-
These types are then used to create types for route export args and props:
493-
494-
- `LoaderArgs`
495-
- `ClientLoaderArgs`
496-
- `ActionArgs`
497-
- `ClientActionArgs`
498-
- `HydrateFallbackProps`
499-
- `ComponentProps` (for the `default` export)
500-
- `ErrorBoundaryProps`
501-
502-
In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
503-
504-
We also plan to generate types for typesafe `Link`s:
505-
506-
```tsx
507-
<Link to="/products/:id" params={{ id: 1 }} />
508-
// ^^^^^^^^^^^^^ ^^^^^^^^^
509-
// typesafe `to` and `params` based on the available routes in your app
510-
```
511-
512-
##### Setup
513-
514-
React Router will generate types into a `.react-router/` directory at the root of your app. This directory is fully managed by React Router and is derived based on your route config (`routes.ts`).
515-
516-
👉 **Add `.react-router/` to `.gitignore`**
517-
518-
```txt
519-
.react-router
520-
```
521-
522-
You should also ensure that generated types for routes are always present before running typechecking, especially for running typechecking in CI.
523-
524-
👉 **Add `react-router typegen` to your `typecheck` command in `package.json`**
525-
526-
```json
527-
{
528-
"scripts": {
529-
"typecheck": "react-router typegen && tsc"
530-
}
531-
}
532-
```
533-
534-
To get TypeScript to use those generated types, you'll need to add them to `include` in `tsconfig.json`. And to be able to import them as if they files next to your route modules, you'll also need to configure `rootDirs`.
535-
536-
👉 **Configure `tsconfig.json` for generated types**
465+
React Router now generates types for each of your route modules and passes typed props to route module component exports ([#11961](https://github.com/remix-run/react-router/pull/11961), [#12019](https://github.com/remix-run/react-router/pull/12019)). You can access those types by importing them from `./+types/<route filename without extension>`.
537466

538-
```json
539-
{
540-
"include": [".react-router/types/**/*"],
541-
"compilerOptions": {
542-
"rootDirs": [".", "./.react-router/types"]
543-
}
544-
}
545-
```
546-
547-
##### `typegen` command
548-
549-
You can manually generate types with the new `typegen` command:
550-
551-
```sh
552-
react-router typegen
553-
```
554-
555-
However, manual type generation is tedious and types can get out of sync quickly if you ever forget to run `typegen`. Instead, we recommend that you setup our new TypeScript plugin which will automatically generate fresh types whenever routes change. That way, you'll always have up-to-date types.
556-
557-
##### TypeScript plugin
558-
559-
To get automatic type generation, you can use our new TypeScript plugin.
560-
561-
👉 **Add the TypeScript plugin to `tsconfig.json`**
562-
563-
```json
564-
{
565-
"compilerOptions": {
566-
"plugins": [{ "name": "@react-router/dev" }]
567-
}
568-
}
569-
```
570-
571-
We plan to add some other goodies to our TypeScript plugin soon, including:
572-
573-
- Automatic `jsdoc` for route exports that include links to official docs
574-
- Autocomplete for route exports
575-
- Warnings for non-HMR compliant exports
576-
577-
###### VSCode
578-
579-
TypeScript looks for plugins registered in `tsconfig.json` in the local `node_modules/`,
580-
but VSCode ships with its own copy of TypeScript that is installed outside of your project.
581-
For TypeScript plugins to work, you'll need to tell VSCode to use the local workspace version of TypeScript.
582-
583-
👉 **Ensure that VSCode is using the workspace version of TypeScript**
584-
585-
This should already be set up for you by a `.vscode/settings.json`:
586-
587-
```json
588-
{
589-
"typescript.tsdk": "node_modules/typescript/lib"
590-
}
591-
```
592-
593-
Alternatively, you can open up any TypeScript file and use <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> to find `Select TypeScript Version` and then select `Use Workspace Version`. You may need to quit VSCode and reopen it for this setting to take effect.
594-
595-
###### Troubleshooting
596-
597-
In VSCode, open up any TypeScript file in your project and then use <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> to select `Open TS Server log`. There should be a log for `[react-router] setup` that indicates that the plugin was resolved correctly. Then look for any errors in the log.
467+
See [_How To > Route Module Type Safety_](https://reactrouter.com/dev/how-to/route-module-type-safety) and [_Explanations > Type Safety_](https://reactrouter.com/dev/explanation/type-safety) for more details.
598468

599469
#### Prerendering
600470

@@ -791,9 +661,7 @@ async function fakeGetSlugsFromCms() {
791661
- [`@react-router/remix-config-routes-adapter`](https://github.com/remix-run/react-router/blob/react-router%407.0.0/packages/react-router-remix-config-routes-adapter/CHANGELOG.md#700)
792662
- [`@react-router/serve`](https://github.com/remix-run/react-router/blob/react-router%407.0.0/packages/react-router-serve/CHANGELOG.md#700)
793663

794-
# **Full Changelog**: [`v6.28.0...v7.0.0`](https://github.com/remix-run/react-router/compare/[email protected]@7.0.0)
795-
796-
> > > > > > > release-next
664+
**Full Changelog**: [`v6.28.0...v7.0.0`](https://github.com/remix-run/react-router/compare/[email protected]@7.0.0)
797665

798666
## v6.28.0
799667

@@ -815,12 +683,6 @@ Date: 2024-11-06
815683

816684
**Full Changelog**: [`v6.27.0...v6.28.0`](https://github.com/remix-run/react-router/compare/[email protected]@6.28.0)
817685

818-
# <<<<<<< HEAD
819-
820-
> > > > > > > dev
821-
822-
> > > > > > > release-next
823-
824686
## v6.27.0
825687

826688
Date: 2024-10-11

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ React Router is a multi-strategy router for React bridging the gap from React 18
1515

1616
## Packages
1717

18-
- [react-router](./modules/react_router)
19-
- [@react-router/dev](./modules/_react_router_dev)
20-
- [@react-router/node](./modules/_react_router_node)
21-
- [@react-router/cloudflare](./modules/_react_router_cloudflare)
22-
- [@react-router/serve](./modules/_react_router_serve)
23-
- [@react-router/fs-routes](./modules/_react_router_fs_routes)
18+
- [`react-router`](./packages/react-router)
19+
- [`@react-router/dev`](./packages/react-router-dev)
20+
- [`@react-router/node`](./packages/react-router-node)
21+
- [`@react-router/cloudflare`](./packages/react-router-cloudflare)
22+
- [`@react-router/serve`](./packages/react-router-serve)
23+
- [`@react-router/fs-routes`](./packages/react-router-fs-routes)
2424

2525
## Previous Versions
2626

contributors.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- alexandernanberg
1818
- alexanderson1993
1919
- alexlbr
20+
- amitdahan
2021
- AmRo045
2122
- amsal
2223
- andreasottosson-polestar
@@ -58,6 +59,7 @@
5859
- christopherchudzicki
5960
- ChristophP
6061
- christowiz
62+
- clavery
6163
- codeape2
6264
- coryhouse
6365
- ctnelson1997
@@ -68,6 +70,7 @@
6870
- dauletbaev
6971
- david-bezero
7072
- david-crespo
73+
- dcblair
7174
- decadentsavant
7275
- dgrijuela
7376
- DigitalNaut
@@ -87,6 +90,7 @@
8790
- faergeek
8891
- FilipJirsak
8992
- focusotter
93+
- foxscotch
9094
- frontsideair
9195
- fyzhu
9296
- fz6m
@@ -202,6 +206,7 @@
202206
- mtendekuyokwa19
203207
- mtliendo
204208
- ned-park
209+
- nikeee
205210
- nilubisan
206211
- Nismit
207212
- nnhjs
@@ -221,8 +226,10 @@
221226
- petersendidit
222227
- printfn
223228
- promet99
229+
- proshunsuke
224230
- pyitphyoaung
225231
- refusado
232+
- reyronald
226233
- rifaidev
227234
- rimian
228235
- robbtraister
@@ -237,8 +244,10 @@
237244
- saul-atomrigs
238245
- sbolel
239246
- scarf005
247+
- sealer3
240248
- senseibarni
241249
- sergiodxa
250+
- serranoarevalo
242251
- sgalhs
243252
- sgrishchenko
244253
- shamsup
@@ -274,6 +283,7 @@
274283
- tomasr8
275284
- tony-sn
276285
- TooTallNate
286+
- tosinamuda
277287
- triangularcube
278288
- trungpv1601
279289
- ttys026

docs/explanation/special-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
} satisfies Config;
2121
```
2222

23-
See the [config API](https://api.reactrouter.com/v7/types/_react_router_dev.config.Config.html) for more information.
23+
See the details on [react-router config API][react-router-config] for more information.
2424

2525
## root.tsx
2626

0 commit comments

Comments
 (0)