Skip to content

Commit

Permalink
feat(remix-dev)!: remove devServerBroadcastDelay config option
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Aug 14, 2023
1 parent c00cd0e commit bc7860e
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 98 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-crews-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": major
---

Remove `devServerBroadcastDelay` config option
8 changes: 0 additions & 8 deletions docs/api/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ title: Conventions

[Moved →][moved-4]

### devServerBroadcastDelay

[Moved →][moved-5]

### devServerPort

[Moved →][moved-6]

### ignoredRouteFiles

[Moved →][moved-7]
Expand Down
21 changes: 0 additions & 21 deletions docs/file-conventions/remix-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@ The path to the browser build, relative to remix.config.js. Defaults to
The path to a directory Remix can use for caching things in development,
relative to `remix.config.js`. Defaults to `".cache"`.

## devServerBroadcastDelay

<docs-warning>This option is deprecated and will likely be removed in a future
stable release. Enable `v2_dev` to eliminate the race conditions that necessitated
this option.</docs-warning>

The delay, in milliseconds, before the dev server broadcasts a reload event.
There is no delay by default.

For v2, the race conditions that necessitated this option have been eliminated.

## devServerPort

<docs-warning>This option is deprecated and will likely be removed in a future
stable release. Enable `v2_dev` and use [`--port` / `v2_dev.port` option][port]
instead.</docs-warning>

The port number to use for the dev websocket server. Defaults to 8002.

For v2, use [`--port` / `dev.port` option][port].

## ignoredRouteFiles

This is an array of globs (via [minimatch][minimatch]) that Remix will match to
Expand Down
1 change: 0 additions & 1 deletion integration/helpers/cf-template/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
export default {
devServerBroadcastDelay: 1000,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverConditions: ["worker"],
Expand Down
7 changes: 0 additions & 7 deletions integration/helpers/deno-template/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
export default {
/*
If live reload causes page to re-render without changes (live reload is too fast),
increase the dev server broadcast delay.
If live reload seems slow, try to decrease the dev server broadcast delay.
*/
devServerBroadcastDelay: 300,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverConditions: ["deno", "worker"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
devServerBroadcastDelay: 1000,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverBuildPath: "functions/[[path]].js",
Expand Down
7 changes: 0 additions & 7 deletions packages/remix-dev/__tests__/fixtures/deno/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
/*
If live reload causes page to re-render without changes (live reload is too fast),
increase the dev server broadcast delay.
If live reload seems slow, try to decrease the dev server broadcast delay.
*/
devServerBroadcastDelay: 300,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverConditions: ["deno", "worker"],
Expand Down
1 change: 0 additions & 1 deletion packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe("readConfig", () => {
"assetsBuildDirectory": Any<String>,
"cacheDirectory": Any<String>,
"dev": Object {},
"devServerBroadcastDelay": 0,
"entryClientFile": "entry.client.tsx",
"entryClientFilePath": Any<String>,
"entryServerFile": "entry.server.tsx",
Expand Down
47 changes: 4 additions & 43 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,6 @@ export interface AppConfig {
*/
dev?: Dev;

/**
* @deprecated
*
* The delay, in milliseconds, before the dev server broadcasts a reload
* event. There is no delay by default.
*
* @deprecated Enable {@link AppConfig.future.v2_dev} to eliminate the race
* conditions that necessitated this option.
*/
devServerBroadcastDelay?: number;

/**
* Additional MDX remark / rehype plugins.
*/
Expand Down Expand Up @@ -252,14 +241,6 @@ export interface RemixConfig {
*/
dev: Dev;

/**
* The delay before the dev (asset) server broadcasts a reload event.
*
* @deprecated Enable {@link RemixConfig.future.v2_dev} to eliminate the race
* conditions that necessitated this option.
*/
devServerBroadcastDelay: number;

/**
* Additional MDX remark / rehype plugins.
*/
Expand Down Expand Up @@ -383,8 +364,8 @@ export async function readConfig(
// shout out to next
// https://github.com/vercel/next.js/blob/b15a976e11bf1dc867c241a4c1734757427d609c/packages/next/server/config.ts#L748-L765
if (process.env.JEST_WORKER_ID) {
// dynamic import does not currently work inside of vm which
// jest relies on so we fall back to require for this case
// dynamic import does not currently work inside vm which
// jest relies on, so we fall back to require for this case
// https://github.com/nodejs/node/issues/35889
appConfigModule = require(configFile);
} else {
Expand Down Expand Up @@ -557,13 +538,6 @@ export async function readConfig(
assetsBuildDirectory
);

if (appConfig.devServerBroadcastDelay) {
devServerBroadcastDelayWarning();
}

// set env variable so un-bundled servers can use it
let devServerBroadcastDelay = appConfig.devServerBroadcastDelay || 0;

let publicPath = addTrailingSlash(appConfig.publicPath || "/build/");

let rootRouteFile = findEntry(appDirectory, "root");
Expand Down Expand Up @@ -615,8 +589,8 @@ export async function readConfig(
}

// Note: When a future flag is removed from here, it should be added to the
// list below so we can let folks know if they have obsolete flags in their
// config. If we ever convert remix.config.js to a TS file so we get proper
// list below, so we can let folks know if they have obsolete flags in their
// config. If we ever convert remix.config.js to a TS file, so we get proper
// typings this won't be necessary anymore.
let future: FutureConfig = {};

Expand Down Expand Up @@ -655,7 +629,6 @@ export async function readConfig(
entryServerFile,
entryServerFilePath,
dev: appConfig.dev ?? {},
devServerBroadcastDelay,
assetsBuildDirectory: absoluteAssetsBuildDirectory,
relativeAssetsBuildDirectory: assetsBuildDirectory,
publicPath,
Expand Down Expand Up @@ -748,15 +721,3 @@ let disjunctionListFormat = new Intl.ListFormat("en", {
style: "long",
type: "disjunction",
});

let devServerBroadcastDelayWarning = () =>
logger.warn(
"The `devServerBroadcastDelay` config option will be removed in v2",
{
details: [
"Enable `v2_dev` to eliminate the race conditions that necessitated this option.",
"-> https://remix.run/docs/en/v1.19.3/pages/v2#devserverbroadcastdelay",
],
key: "devServerBroadcastDelayWarning",
}
);
2 changes: 1 addition & 1 deletion packages/remix-dev/devServer/liveReload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function liveReload(
client.send(JSON.stringify(event));
}
});
}, config.devServerBroadcastDelay);
}, 500);
}

function log(message: string) {
Expand Down
1 change: 0 additions & 1 deletion templates/cloudflare-pages/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
export default {
devServerBroadcastDelay: 1000,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverBuildPath: "functions/[[path]].js",
Expand Down
7 changes: 0 additions & 7 deletions templates/deno/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
/*
If live reload causes page to re-render without changes (live reload is too fast),
increase the dev server broadcast delay.
If live reload seems slow, try to decrease the dev server broadcast delay.
*/
devServerBroadcastDelay: 300,
ignoredRouteFiles: ["**/.*"],
server: "./server.ts",
serverConditions: ["deno", "worker"],
Expand Down

0 comments on commit bc7860e

Please sign in to comment.