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

Rename future flag from fogOfWar to lazyRouteDiscovery #9763

Merged
merged 1 commit into from
Jul 18, 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
8 changes: 8 additions & 0 deletions .changeset/happy-dots-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@remix-run/dev": minor
"@remix-run/react": minor
"@remix-run/server-runtime": minor
"@remix-run/testing": minor
Comment on lines +2 to +5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did minor here instead of patch since I'm not considering this a change to a current flag but moreso the deletion of a current flag and the introduction of a new one.

---

Rename `future.unstable_fogOfWar` to `future.unstable_lazyRouteDiscovery` for clarity
4 changes: 2 additions & 2 deletions 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_fogOfWar`][fog-of-war].
Defines the route discovery behavior when using [`future.unstable_lazyRouteDiscovery`][lazy-route-discovery].

```tsx
<>
Expand Down Expand Up @@ -236,4 +236,4 @@ Please note that this API is marked unstable and may be subject to breaking chan
[document-start-view-transition]: https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition
[use-view-transition-state]: ../hooks/use-view-transition-state
[relativesplatpath]: ../hooks/use-resolved-path#splat-paths
[fog-of-war]: ../guides/fog-of-war
[lazy-route-discovery]: ../guides/lazy-route-discovery
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Fog of War
title: Lazy Route Discovery
---

# Fog Of War
# Lazy Route Discovery (a.k.a. "Fog of War")

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

Remix introduced support for "Fog of War" ([RFC][rfc]) behind the `future.unstable_fogOfWar` [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]).
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].

## Current Behavior

Expand Down Expand Up @@ -61,3 +61,4 @@ If you wish to opt-out of this eager route discovery on a per-link basis, you ca
[link-discover]: ../components/link#discover
[rr-v7]: https://remix.run/blog/merging-remix-and-react-router
[rr-v7-2]: https://remix.run/blog/incremental-path-to-react-19
[blog-post]: https://remix.run/blog/fog-of-war
6 changes: 3 additions & 3 deletions docs/start/future-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ You likely won't need to adjust any code, unless you had custom logic inside of

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

## unstable_fogOfWar
## unstable_lazyRouteDiscovery

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

[development-strategy]: ../guides/api-development-strategy
[fetcherpersist-rfc]: https://github.com/remix-run/remix/discussions/7698
[relativesplatpath-changelog]: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#futurev3_relativesplatpath
[single-fetch]: ../guides/single-fetch
[fog-of-war]: ../guides/fog-of-war
[lazy-route-discovery]: ../guides/lazy-route-discovery
[vite]: https://vitejs.dev
[vite-docs]: ../guides/vite
[supported-remix-config-options]: ../file-conventions/vite-config
Expand Down
26 changes: 13 additions & 13 deletions integration/fog-of-war-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -152,7 +152,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: getFiles(),
Expand All @@ -176,7 +176,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: getFiles(),
Expand Down Expand Up @@ -211,7 +211,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: getFiles(),
Expand Down Expand Up @@ -244,7 +244,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -310,7 +310,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -371,7 +371,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -422,7 +422,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -486,7 +486,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -534,7 +534,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -605,7 +605,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -721,7 +721,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down Expand Up @@ -845,7 +845,7 @@ test.describe("Fog of War", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
},
},
files: {
Expand Down
2 changes: 1 addition & 1 deletion integration/prefetch-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ test.describe("single fetch", () => {
let fixture = await createFixture({
config: {
future: {
unstable_fogOfWar: true,
unstable_lazyRouteDiscovery: true,
unstable_singleFetch: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("readConfig", () => {
"entryServerFile": "entry.server.tsx",
"entryServerFilePath": Any<String>,
"future": {
"unstable_fogOfWar": false,
"unstable_lazyRouteDiscovery": false,
"unstable_singleFetch": false,
"v3_fetcherPersist": false,
"v3_relativeSplatPath": false,
Expand Down
9 changes: 5 additions & 4 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface FutureConfig {
v3_relativeSplatPath: boolean;
v3_throwAbortReason: boolean;
unstable_singleFetch: boolean;
unstable_fogOfWar: boolean;
unstable_lazyRouteDiscovery: boolean;
}

type NodeBuiltinsPolyfillOptions = Pick<
Expand Down Expand Up @@ -528,9 +528,9 @@ export async function resolveConfig(
entryServerFile = `entry.server.${serverRuntime}.tsx`;
}

if (isSpaMode && appConfig.future?.unstable_fogOfWar === true) {
if (isSpaMode && appConfig.future?.unstable_lazyRouteDiscovery === true) {
throw new Error(
"You can not use `future.unstable_fogOfWar` in SPA Mode (`ssr: false`)"
"You can not use `future.unstable_lazyRouteDiscovery` in SPA Mode (`ssr: false`)"
);
}

Expand Down Expand Up @@ -609,7 +609,8 @@ export async function resolveConfig(
v3_relativeSplatPath: appConfig.future?.v3_relativeSplatPath === true,
v3_throwAbortReason: appConfig.future?.v3_throwAbortReason === true,
unstable_singleFetch: appConfig.future?.unstable_singleFetch === true,
unstable_fogOfWar: appConfig.future?.unstable_fogOfWar === true,
unstable_lazyRouteDiscovery:
appConfig.future?.unstable_lazyRouteDiscovery === true,
};

if (appConfig.future) {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-react/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface EntryContext extends RemixContextObject {
export interface FutureConfig {
v3_fetcherPersist: boolean;
v3_relativeSplatPath: boolean;
unstable_fogOfWar: boolean;
unstable_lazyRouteDiscovery: boolean;
unstable_singleFetch: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/remix-react/fog-of-war.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const URL_LIMIT = 7680;
let fogOfWar: FogOfWarInfo | null = null;

export function isFogOfWarEnabled(future: FutureConfig, isSpaMode: boolean) {
return future.unstable_fogOfWar === true && !isSpaMode;
return future.unstable_lazyRouteDiscovery === true && !isSpaMode;
}

export function getPartialManifest(manifest: AssetsManifest, router: Router) {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface FutureConfig {
v3_fetcherPersist: boolean;
v3_relativeSplatPath: boolean;
v3_throwAbortReason: boolean;
unstable_fogOfWar: boolean;
unstable_lazyRouteDiscovery: boolean;
unstable_singleFetch: boolean;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/remix-testing/create-remix-stub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export function createRemixStub(
future: {
v3_fetcherPersist: future?.v3_fetcherPersist === true,
v3_relativeSplatPath: future?.v3_relativeSplatPath === true,
unstable_fogOfWar: future?.unstable_fogOfWar === true,
unstable_lazyRouteDiscovery:
future?.unstable_lazyRouteDiscovery === true,
unstable_singleFetch: future?.unstable_singleFetch === true,
},
manifest: {
Expand Down