Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Revert "fix(webview): reduce CPU usage on Windows"

Louis Beaumontfa9aebdd5ea1
diff --git a/apps/screenpipe-app-tauri/app/shortcut-reminder/screen-matrix.tsx b/apps/screenpipe-app-tauri/app/shortcut-reminder/screen-matrix.tsx
index 3a88d8a22..40e418294 100644
--- a/apps/screenpipe-app-tauri/app/shortcut-reminder/screen-matrix.tsx
+++ b/apps/screenpipe-app-tauri/app/shortcut-reminder/screen-matrix.tsx
@@ -57,11 +57,7 @@ export function ScreenMatrix({
canvas.height = CANVAS_H * dpr;
ctx.scale(dpr, dpr);
- let stopped = false;
-
const draw = () => {
- if (stopped) return;
-
ctx.clearRect(0, 0, canvasW, CANVAS_H);
const isActive = activeRef.current;
@@ -105,24 +101,10 @@ export function ScreenMatrix({
rafRef.current = requestAnimationFrame(draw);
};
- // Only run RAF when the tab is visible
- const onVisibilityChange = () => {
- if (document.hidden) {
- cancelAnimationFrame(rafRef.current);
- } else if (!stopped) {
- rafRef.current = requestAnimationFrame(draw);
- }
- };
- document.addEventListener("visibilitychange", onVisibilityChange);
-
- if (!document.hidden) {
- rafRef.current = requestAnimationFrame(draw);
- }
+ rafRef.current = requestAnimationFrame(draw);
return () => {
- stopped = true;
cancelAnimationFrame(rafRef.current);
- document.removeEventListener("visibilitychange", onVisibilityChange);
};
}, []);
diff --git a/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx b/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx
index 4b9e15066..b2e961a04 100644
--- a/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx
+++ b/apps/screenpipe-app-tauri/components/onboarding/particle-stream.tsx
@@ -233,20 +233,7 @@ export function ParticleStream({
const cx = width / 2, cy = height * 0.42;
- let stopped = false;
-
- const onVisibilityChange = () => {
- if (document.hidden) {
- cancelAnimationFrame(animRef.current);
- } else if (!stopped) {
- animRef.current = requestAnimationFrame(draw);
- }
- };
- document.addEventListener("visibilitychange", onVisibilityChange);
-
function draw() {
- if (stopped) return;
-
const p = progressRef.current;
const f = ++frameRef.current;
const s = state;
@@ -551,14 +538,8 @@ export function ParticleStream({
}
const w = width, h = height; // closure
- if (!document.hidden) {
- animRef.current = requestAnimationFrame(draw);
- }
- return () => {
- stopped = true;
- cancelAnimationFrame(animRef.current);
- document.removeEventListener("visibilitychange", onVisibilityChange);
- };
+ draw();
+ return () => cancelAnimationFrame(animRef.current);
}, [width, height]);
return (
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
index 1e010936c..496844ba3 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
@@ -169,7 +169,7 @@ export function useHealthCheck() {
// Start retry interval if not already running
if (!retryIntervalRef.current) {
- retryIntervalRef.current = setInterval(fetchHealth, 10000);
+ retryIntervalRef.current = setInterval(fetchHealth, 3000);
}
};
@@ -201,7 +201,7 @@ export function useHealthCheck() {
// Only start retry if this wasn't a manual close
if (!retryIntervalRef.current && event.code !== 1000) {
- retryIntervalRef.current = setInterval(fetchHealth, 10000);
+ retryIntervalRef.current = setInterval(fetchHealth, 3000);
}
};
} catch (error) {
@@ -217,7 +217,7 @@ export function useHealthCheck() {
}
if (!retryIntervalRef.current) {
- retryIntervalRef.current = setInterval(fetchHealth, 10000);
+ retryIntervalRef.current = setInterval(fetchHealth, 3000);
}
}
}, [setServerDown]); // stable deps — no cycle
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-timeline-store.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-timeline-store.tsx
index 57faf9104..bb9d829fa 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-timeline-store.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-timeline-store.tsx
@@ -12,7 +12,7 @@ import { saveFramesToCache, loadCachedFrames } from "./use-timeline-cache";
let frameBuffer: StreamTimeSeriesResponse[] = [];
let flushTimer: ReturnType<typeof setTimeout> | null = null;
let progressUpdateTimer: ReturnType<typeof setTimeout> | null = null;
-const FLUSH_INTERVAL_MS = 500; // Flush every 500ms to reduce CPU usage
+const FLUSH_INTERVAL_MS = 150; // Flush every 150ms for smooth progressive loading
const PROGRESS_UPDATE_INTERVAL_MS = 500; // Only update progress indicator every 500ms to prevent flickering
// Connection retry logic - don't show error immediately, server might be starting