You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stabilize the `future.v3_routeConfig` future flag, replacing `future.unstable_routeConfig`. This enables support for `routes.ts` to assist with the migration to React Router v7.
6
+
7
+
Note that if you had already enabled the `future.unstable_routeConfig` flag, your route config in `app/routes.ts` is no longer defined via the `routes` export and must now be defined via the default export.
8
+
9
+
```diff
10
+
import { type RouteConfig } from "@remix-run/route-config";
Copy file name to clipboardExpand all lines: docs/start/future-flags.md
+43-23Lines changed: 43 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -511,7 +511,29 @@ function handleBrowserRequest(/* ... */) {
511
511
}
512
512
```
513
513
514
-
## unstable_routeConfig
514
+
## v3_lazyRouteDiscovery
515
+
516
+
**Background**
517
+
518
+
With this flag, Remix no longer sends the full route manifest up to the client on initial load. Instead, Remix only sends the server-rendered routes up in the manifest and then fetches the remaining routes as the user navigated around the application. Additional details are available in the [docs][lazy-route-discovery] and the [blog post][lazy-route-discovery-blog-post]
519
+
520
+
👉 **Enable the Flag**
521
+
522
+
```ts filename=vite.config.ts
523
+
remix({
524
+
future: {
525
+
v3_lazyRouteDiscovery: true,
526
+
},
527
+
});
528
+
```
529
+
530
+
**Update your Code**
531
+
532
+
You shouldn't need to make any changes to your application code for this feature to work.
533
+
534
+
You may find some usage for the new [`<Link discover>`][discover-prop] API if you wish to disable eager route discovery on certain links.
535
+
536
+
## v3_routeConfig
515
537
516
538
<docs-warning>
517
539
@@ -521,7 +543,7 @@ This flag requires the [Vite plugin][vite-plugin].
521
543
522
544
Config-based routing is the new default in React Router v7, configured via the `routes.ts` file in the app directory. Support for `routes.ts` and its related APIs in Remix are designed as a migration path to help minimize the number of changes required when moving your Remix project over to React Router v7. While some new packages have been introduced within the `@remix-run` scope, these new packages only exist to keep the code in `routes.ts` as similar as possible to the equivalent code for React Router v7.
523
545
524
-
When the `unstable_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. If you prefer to keep using Remix's file-based routing we cover how to enable it in `routes.ts` below.
546
+
When the `v3_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. To opt back in to file system routing, this can be explicitly configured within `routes.ts` as we'll cover below.
525
547
526
548
**Update your code**
527
549
@@ -532,7 +554,7 @@ To migrate Remix's file system routing and route config to the equivalent setup
This is a good way to check that your new `routes.ts` file is being picked up successfully. Your app should now be rendering a blank page since there aren't any routes defined yet.
@@ -575,7 +597,7 @@ This package matches the API of React Router v7's `@react-router/fs-routes`, mak
If you're defining config-based routes in this way, you might want to consider migrating to the new route config API since it's more streamlined while still being very similar to the old API. For example, the routes above would look like this:
@@ -637,14 +657,14 @@ import {
637
657
index,
638
658
} from"@remix-run/route-config";
639
659
640
-
exportconst routes:RouteConfig= [
660
+
exportdefault [
641
661
index("home/route.tsx"),
642
662
route("about", "about/route.tsx"),
643
663
layout("concerts/layout.tsx", [
644
664
route("trending", "concerts/trending.tsx"),
645
665
route(":city", "concerts/city.tsx"),
646
666
]),
647
-
];
667
+
]satisfiesRouteConfig;
648
668
```
649
669
650
670
Note that if you need to mix and match different route config approaches, they can be merged together into a single array of routes. The `RouteConfig` type ensures that everything is still valid.
@@ -655,13 +675,13 @@ import type { RouteConfig } from "@remix-run/route-config";
0 commit comments