Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(hud): send the click-through cleanup through the wrapper that owns the mirror

Claude51f3c6d2f271
diff --git a/src/components/launch/LaunchWindow.test.tsx b/src/components/launch/LaunchWindow.test.tsx
index 3fdb7caae..0038ca2ea 100644
--- a/src/components/launch/LaunchWindow.test.tsx
+++ b/src/components/launch/LaunchWindow.test.tsx
@@ -1,6 +1,7 @@
// @vitest-environment jsdom
import "@testing-library/jest-dom";
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { StrictMode } from "react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { TooltipProvider } from "../ui/tooltip";
import { HUD_BAR_BOTTOM, HUD_POPOVER_GAP, HUD_POPOVER_MAX_HEIGHT } from "./hudGeometry";
@@ -465,6 +466,29 @@ describe("LaunchWindow record button", () => {
}
});
+ // The mount effect's cleanup used to send `ignore=false` straight down the
+ // bridge, bypassing the wrapper that owns `hudIgnoreMouseEventsRef`. That left
+ // the mirror claiming the HUD was click-through while the main process had just
+ // been told the opposite, and the next run then deduped against the stale value
+ // and sent nothing at all — so the HUD stayed interactive with no way for the
+ // renderer to ask again. StrictMode runs mount → cleanup → mount on every mount,
+ // which makes dev the one environment where the click-through path never ran.
+ it("keeps the main process and the renderer's mirror in step across a remount", async () => {
+ platformState.value = "win32";
+
+ render(
+ <StrictMode>
+ <TooltipProvider>
+ <LaunchWindow />
+ </TooltipProvider>
+ </StrictMode>,
+ );
+
+ await waitFor(() => {
+ expect(window.electronAPI.setHudOverlayIgnoreMouseEvents).toHaveBeenLastCalledWith(true);
+ });
+ });
+
it("unsubscribes from the pushed cursor when the HUD unmounts", async () => {
platformState.value = "win32";
diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsx
index 9c184438e..ea2758eab 100644
--- a/src/components/launch/LaunchWindow.tsx
+++ b/src/components/launch/LaunchWindow.tsx
@@ -425,7 +425,13 @@ export function LaunchWindow() {
useEffect(() => {
setHudMouseEventsEnabled(false);
return () => {
- window.electronAPI?.setHudOverlayIgnoreMouseEvents?.(false);
+ // Through the wrapper, not the bridge under it: the wrapper owns
+ // `hudIgnoreMouseEventsRef`, and a raw send here leaves that mirror
+ // describing a state the main process has already left. The next run
+ // then dedupes against a mirror that is wrong and sends nothing — under
+ // StrictMode that is every mount, so the click-through path quietly
+ // stops being exercised on the machine it is developed on.
+ setHudMouseEventsEnabled(true);
};
}, [setHudMouseEventsEnabled]);