Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize future flags #10072

Merged
merged 6 commits into from
Oct 9, 2024
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
9 changes: 9 additions & 0 deletions .changeset/stabilize-future-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@remix-run/dev": minor
"@remix-run/react": minor
"@remix-run/server-runtime": minor
---

Stabilize future flags
- `future.unstable_singleFetch` -> `future.v3_singleFetch`
- `future.unstable_lazyRouteDiscovery` -> `future.v3_lazyRouteDiscovery`
2 changes: 1 addition & 1 deletion docs/components/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can also pass a `Partial<Path>` value:

### `discover`

Defines the route discovery behavior when using [`future.unstable_lazyRouteDiscovery`][lazy-route-discovery].
Defines the route discovery behavior when using [`future.v3_lazyRouteDiscovery`][lazy-route-discovery].

```tsx
<>
Expand Down
3 changes: 2 additions & 1 deletion docs/guides/lazy-route-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Lazy Route Discovery

<docs-warning>This is an unstable API and will continue to change, do not adopt in production</docs-warning>

Remix introduced support for Lazy Route Discovery (a.k.a. "Fog of War") ([RFC][rfc]) behind the `future.unstable_lazyRouteDiscovery` [Future Flag][future-flags] in [`v2.10.0`][2.10.0]. This allows you to opt-into this behavior which will become the default in the next major version of Remix - a.k.a. React Router v7 ([1][rr-v7], [2][rr-v7-2]). For more information on this feature, please check out the [blog post][blog-post].
Remix introduced support for Lazy Route Discovery (a.k.a. "Fog of War") ([RFC][rfc]) behind the `future.unstable_lazyRouteDiscovery` [Future Flag][future-flags] in [`v2.10.0`][2.10.0] (later stabilized as `future.v3_lazyRouteDiscovery` in [`v2.13.0`][2.13.0]). This allows you to opt-into this behavior which will become the default in the next major version of Remix - a.k.a. React Router v7 ([1][rr-v7], [2][rr-v7-2]). For more information on this feature, please check out the [blog post][blog-post].

## Current Behavior

Expand Down Expand Up @@ -56,6 +56,7 @@ If you wish to opt-out of this eager route discovery on a per-link basis, you ca
[rfc]: https://github.com/remix-run/react-router/discussions/11113
[future-flags]: ../guides/api-development-strategy
[2.10.0]: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#v2100
[2.13.0]: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#v2130
[link]: ../components/link
[navlink]: ../components/nav-link
[link-discover]: ../components/link#discover
Expand Down
11 changes: 6 additions & 5 deletions docs/guides/single-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Single Fetch is a new data loading strategy and streaming format. When you enabl

## Overview

Remix introduced support for "Single Fetch" ([RFC][rfc]) behind the [`future.unstable_singleFetch`][future-flags] flag in [`v2.9.0`][2.9.0] which allows you to opt-into this behavior. Single Fetch will be the default in [React Router v7][merging-remix-and-rr].
Remix introduced support for "Single Fetch" ([RFC][rfc]) behind the [`future.unstable_singleFetch`][future-flags] flag in [`v2.9.0`][2.9.0] (later stabilized as `future.v3_singleFetch` in [`v2.13.0`][2.13.0]) which allows you to opt-into this behavior. Single Fetch will be the default in [React Router v7][merging-remix-and-rr].

Enabling Single Fetch is intended to be low-effort up-front, and then allow you to adopt all breaking changes iteratively over time. You can start by applying the minimal required changes to [enable Single Fetch][start], then use the [migration guide][migration-guide] to make incremental changes in your application to ensure a smooth, non-breaking upgrade to [React Router v7][merging-remix-and-rr].

Expand All @@ -26,7 +26,7 @@ export default defineConfig({
remix({
future: {
// ...
unstable_singleFetch: true,
v3_singleFetch: true,
},
}),
// ...
Expand Down Expand Up @@ -147,15 +147,15 @@ With Single Fetch, naked objects will be streamed directly, so the built-in type

#### Enable Single Fetch types

To switch over to Single Fetch types, you should [augment][augment] Remix's `Future` interface with `unstable_singleFetch: true`.
To switch over to Single Fetch types, you should [augment][augment] Remix's `Future` interface with `v3_singleFetch: true`.
You can do this in any file covered by your `tsconfig.json` > `include`.
We recommend you do this in your `vite.config.ts` to keep it colocated with the `future.unstable_singleFetch` future flag in the Remix plugin:
We recommend you do this in your `vite.config.ts` to keep it colocated with the `future.v3_singleFetch` future flag in the Remix plugin:

```ts
declare module "@remix-run/node" {
// or cloudflare, deno, etc.
interface Future {
unstable_singleFetch: true;
v3_singleFetch: true;
}
}
```
Expand Down Expand Up @@ -465,6 +465,7 @@ Revalidation is handled via a `?_routes` query string parameter on the single fe
[entry-server]: ../file-conventions/entry.server
[client-loader]: ../route/client-loader
[2.9.0]: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#v290
[2.13.0]: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#v2130
[rfc]: https://github.com/remix-run/remix/discussions/7640
[turbo-stream]: https://github.com/jacob-ebey/turbo-stream
[rendertopipeablestream]: https://react.dev/reference/react-dom/server/renderToPipeableStream
Expand Down
4 changes: 2 additions & 2 deletions docs/start/future-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@ remix({

You likely won't need to adjust any code, unless you had custom logic inside of `handleError` that was matching the previous error message to differentiate it from other errors.

## unstable_singleFetch
## v3_singleFetch

Opt into [Single Fetch][single-fetch] behavior (details will be expanded once the flag stabilizes).

## unstable_lazyRouteDiscovery
## v3_lazyRouteDiscovery

Opt into [Lazy Route Discovery][lazy-route-discovery] behavior (details will be expanded once the flag stabilizes).

Expand Down
2 changes: 1 addition & 1 deletion integration/action-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/catch-boundary-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/catch-boundary-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/client-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ test.describe("single fetch", () => {
...init,
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion integration/defer-loader-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
4 changes: 2 additions & 2 deletions integration/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down Expand Up @@ -2289,7 +2289,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
14 changes: 7 additions & 7 deletions integration/error-boundary-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down Expand Up @@ -1835,7 +1835,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down Expand Up @@ -2016,7 +2016,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down Expand Up @@ -2379,7 +2379,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: getFiles({ includeRootErrorBoundary: false }),
Expand Down Expand Up @@ -2455,7 +2455,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: getFiles({ includeRootErrorBoundary: true }),
Expand Down Expand Up @@ -2525,7 +2525,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: getFiles({
Expand Down Expand Up @@ -2614,7 +2614,7 @@ test.describe("single fetch", () => {
let fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/error-boundary-v2-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/error-data-request-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
6 changes: 3 additions & 3 deletions integration/error-sanitization-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: routeFiles,
Expand Down Expand Up @@ -857,7 +857,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: routeFiles,
Expand Down Expand Up @@ -1038,7 +1038,7 @@ test.describe("single fetch", () => {
{
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/fetcher-layout-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
4 changes: 2 additions & 2 deletions integration/fetcher-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down Expand Up @@ -965,7 +965,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/file-uploads-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ test.describe("single fetch", () => {
fixture = await createFixture({
config: {
future: {
unstable_singleFetch: true,
v3_singleFetch: true,
},
},
files: {
Expand Down
Loading