Skip to content

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

chore:safewrapper consistency and hide countdown overlay before starting recording setup.

Galactic994a65ab81711a
diff --git a/src/App.tsx b/src/App.tsx
index a947c9e37..4045b5dc6 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -25,12 +25,14 @@ export default function App() {
document.documentElement.style.background = "transparent";
document.getElementById("root")?.style.setProperty("background", "transparent");
}
+ }, [windowType]);
+ useEffect(() => {
// Load custom fonts on app initialization
loadAllCustomFonts().catch((error) => {
console.error("Failed to load custom fonts:", error);
});
- }, [windowType]);
+ }, []);
const content = (() => {
switch (windowType) {
diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts
index 6644f42fd..ca14dfe8e 100644
--- a/src/hooks/useScreenRecorder.ts
+++ b/src/hooks/useScreenRecorder.ts
@@ -370,15 +370,6 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
};
}, [teardownMedia]);
- const cancelCountdown = () => {
- const activeRunId = countdownRunId.current;
- countdownRunId.current += 1;
- setCountdownActive(false);
- void window.electronAPI.hideCountdownOverlay(activeRunId).catch((error) => {
- console.warn("Failed to hide countdown overlay during cancel:", error);
- });
- };
-
const safeShowCountdownOverlay = async (value: number, runId: number) => {
try {
await window.electronAPI.showCountdownOverlay(value, runId);
@@ -389,6 +380,13 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
}
};
+ const cancelCountdown = () => {
+ const activeRunId = countdownRunId.current;
+ countdownRunId.current += 1;
+ setCountdownActive(false);
+ void safeHideCountdownOverlay(activeRunId);
+ };
+
const safeSetCountdownOverlayValue = async (value: number, runId: number) => {
try {
await window.electronAPI.setCountdownOverlayValue(value, runId);
@@ -436,6 +434,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
return;
}
+ let overlayHiddenBeforeStart = false;
try {
const values = [3, 2, 1];
const overlayShown = await safeShowCountdownOverlay(values[0], runId);
@@ -464,9 +463,17 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
return;
}
+ setCountdownActive(false);
+ await safeHideCountdownOverlay(runId);
+ overlayHiddenBeforeStart = true;
+
+ if (countdownRunId.current !== runId) {
+ return;
+ }
+
await startRecording(runId);
} finally {
- if (countdownRunId.current === runId) {
+ if (!overlayHiddenBeforeStart && countdownRunId.current === runId) {
setCountdownActive(false);
await safeHideCountdownOverlay(runId);
}