Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"beige-buckets-lick",
"big-bags-report",
"brave-shirts-sneeze",
"calm-lies-destroy",
"chilled-beers-sell",
"cuddly-dingos-tickle",
"dirty-ladybugs-grow",
Expand All @@ -33,6 +34,7 @@
"ninety-spoons-suffer",
"odd-yaks-kneel",
"red-sheep-push",
"shy-guests-tickle",
"silver-planes-relate",
"sixty-otters-teach",
"slimy-pugs-sip",
Expand Down
2 changes: 1 addition & 1 deletion .changeset/shy-guests-tickle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"@remix-run/router": patch
---

fix: Avoid suspense loops on promise aborted values
fix: Avoid suspense loops on promise aborted values (#9226)
8 changes: 8 additions & 0 deletions packages/react-router-dom-v5-compat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# react-router-dom-v5-compat

## 6.4.0-pre.15

### Patch Changes

- Updated dependencies
- [email protected]
- [email protected]

## 6.4.0-pre.14

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-dom-v5-compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-dom-v5-compat",
"version": "6.4.0-pre.14",
"version": "6.4.0-pre.15",
"description": "Migration path to React Router v6 from v4/5",
"keywords": [
"react",
Expand All @@ -24,7 +24,7 @@
"types": "./dist/index.d.ts",
"dependencies": {
"history": "^5.3.0",
"react-router": "6.4.0-pre.14"
"react-router": "6.4.0-pre.15"
},
"peerDependencies": {
"react": ">=16.8",
Expand Down
88 changes: 88 additions & 0 deletions packages/react-router-dom/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,93 @@
# react-router-dom

## 6.4.0-pre.15

### Patch Changes

- fix: remove internal router singleton (#9227)

This change removes the internal module-level `routerSingleton` we create and maintain inside our data routers since it was causing a number of headaches for non-simple use cases:

- Unit tests are a pain because you need to find a way to reset the singleton in-between tests
- Use use a `_resetModuleScope` singleton for our tests
- ...but this isn't exposed to users who may want to do their own tests around our router
- The JSX children `<Route>` objects cause non-intuitive behavior based on idiomatic react expectations
- Conditional runtime `<Route>`'s won't get picked up
- Adding new `<Route>`'s during local dev won't get picked up during HMR
- Using external state in your elements doesn't work as one might expect (see #9225)

Instead, we are going to lift the singleton out into user-land, so that they create the router singleton and manage it outside the react tree - which is what react 18 is encouraging with `useSyncExternalStore` anyways! This also means that since users create the router - there's no longer any difference in the rendering aspect for memory/browser/hash routers (which only impacts router/history creation) - so we can get rid of those and trim to a simple `RouterProvider`

```jsx
// Before
function App() {
<DataBrowserRouter>
<Route path="/" element={<Layout />}>
<Route index element={<Home />}>
</Route>
<DataBrowserRouter>
}

// After
let router = createBrowserRouter([{
path: "/",
element: <Layout />,
children: [{
index: true,
element: <Home />,
}]
}]);

function App() {
return <RouterProvider router={router} />
}
```

If folks still prefer the JSX notation, they can leverage `createRoutesFromElements` (aliased from `createRoutesFromChildren` since they are not "children" in this usage):

```jsx
let routes = createRoutesFromElements(
<Route path="/" element={<Layout />}>
<Route index element={<Home />}>
</Route>
);
let router = createBrowserRouter(routes);

function App() {
return <RouterProvider router={router} />
}
```

And now they can also hook into HMR correctly for router disposal:

```
if (import.meta.hot) {
import.meta.hot.dispose(() => router.dispose());
}
```

And finally since `<RouterProvider>` accepts a router, it makes unit testing easer since you can create a fresh router with each test.

**Removed APIs**

- `<DataMemoryRouter>`
- `<DataBrowserRouter>`
- `<DataHashRouter>`
- `<DataRouterProvider>`
- `<DataRouter>`

**Modified APIs**

- `createMemoryRouter`/`createBrowserRouter`/`createHashRouter` used to live in `@remix-run/router` to prevent devs from needing to create their own `history`. These are now moved to `react-router`/`react-router-dom` and handle the `RouteObject -> AgnosticRouteObject` conversion.

**Added APIs**

- `<RouterProvider>`
- `createRoutesFromElements` (alias of `createRoutesFromChildren`)

- Updated dependencies
- [email protected]

## 6.4.0-pre.14

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-dom",
"version": "6.4.0-pre.14",
"version": "6.4.0-pre.15",
"description": "Declarative routing for React web applications",
"keywords": [
"react",
Expand All @@ -23,7 +23,7 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"react-router": "6.4.0-pre.14"
"react-router": "6.4.0-pre.15"
},
"devDependencies": {
"react": "^18.2.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/react-router-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# react-router-native

## 6.4.0-pre.15

### Patch Changes

- Updated dependencies
- [email protected]

## 6.4.0-pre.14

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-native",
"version": "6.4.0-pre.14",
"version": "6.4.0-pre.15",
"description": "Declarative routing for React Native applications",
"keywords": [
"react",
Expand All @@ -22,7 +22,7 @@
"types": "./dist/index.d.ts",
"dependencies": {
"@ungap/url-search-params": "^0.1.4",
"react-router": "6.4.0-pre.14"
"react-router": "6.4.0-pre.15"
},
"devDependencies": {
"react": "^18.2.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/react-router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# react-router

## 6.4.0-pre.15

### Patch Changes

- fix: remove internal router singleton (#9227)
- fix: Avoid suspense loops on promise aborted values (#9226)
- Updated dependencies
- @remix-run/[email protected]

## 6.4.0-pre.14

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router",
"version": "6.4.0-pre.14",
"version": "6.4.0-pre.15",
"description": "Declarative routing for React",
"keywords": [
"react",
Expand All @@ -23,7 +23,7 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"@remix-run/router": "0.2.0-pre.9"
"@remix-run/router": "0.2.0-pre.10"
},
"devDependencies": {
"react": "^18.2.0"
Expand Down
7 changes: 7 additions & 0 deletions packages/router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @remix-run/router

## 0.2.0-pre.10

### Patch Changes

- fix: remove internal router singleton (#9227)
- fix: Avoid suspense loops on promise aborted values (#9226)

## 0.2.0-pre.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-run/router",
"version": "0.2.0-pre.9",
"version": "0.2.0-pre.10",
"description": "Nested/Data-driven/Framework-agnostic Routing",
"keywords": [
"remix",
Expand Down