Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(dev): bypass the HTTP cache when loading the Vite dev server
EtienneLescot53004e0bf228
diff --git a/electron/dev-http-cache.test.ts b/electron/dev-http-cache.test.tsnew file mode 100644index 000000000..2ef9f30a6--- /dev/null+++ b/electron/dev-http-cache.test.ts@@ -0,0 +1,17 @@+import { describe, expect, it, vi } from "vitest";+import { disableHttpCacheForDevServer } from "./dev-http-cache";++describe("disableHttpCacheForDevServer", () => {+ it("disables the HTTP cache when loading from a Vite dev server", () => {+ const commandLine = { appendSwitch: vi.fn() };+ disableHttpCacheForDevServer(commandLine, { VITE_DEV_SERVER_URL: "http://localhost:5173" });+ expect(commandLine.appendSwitch).toHaveBeenCalledTimes(1);+ expect(commandLine.appendSwitch).toHaveBeenCalledWith("disable-http-cache");+ });++ it("leaves the HTTP cache alone without a dev server", () => {+ const commandLine = { appendSwitch: vi.fn() };+ disableHttpCacheForDevServer(commandLine, {});+ expect(commandLine.appendSwitch).not.toHaveBeenCalled();+ });+});diff --git a/electron/dev-http-cache.ts b/electron/dev-http-cache.tsnew file mode 100644index 000000000..562872c9b--- /dev/null+++ b/electron/dev-http-cache.ts@@ -0,0 +1,12 @@+// Dev only: every worktree serves its own Vite on localhost:5173 into the same userData+// profile, so the HTTP cache replays another server's response (seen: HTML for+// /src/styles/fonts.css). The module graph dies, the HUD never paints and shows as a black+// rectangle. Nothing on a dev server is worth caching.+export function disableHttpCacheForDevServer(+ commandLine: { appendSwitch(name: string): void },+ env: Record<string, string | undefined>,+): void {+ if (env["VITE_DEV_SERVER_URL"]) {+ commandLine.appendSwitch("disable-http-cache");+ }+}diff --git a/electron/main.ts b/electron/main.tsindex ec961aead..c01cfdfba 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -39,6 +39,7 @@ import {} from "./background-update";import { parseCliArgs } from "./cli/args";import { runCli } from "./cli/cliMain";+import { disableHttpCacheForDevServer } from "./dev-http-cache";import { isDiagnosticModeEnabled, mainLogBuffer } from "./diagnostics/main-log-buffer";import { buildEditMenuSubmenu, type EditorUndoRedoChannel, routeEditorUndoRedo } from "./edit-menu";import {@@ -100,6 +101,8 @@ if (process.platform === "linux") {}}+disableHttpCacheForDevServer(app.commandLine, process.env);+installMainProcessErrorGuards();export const RECORDINGS_DIR = path.join(app.getPath("userData"), "recordings");