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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: pipe enable toggle feels instant with optimistic UI update
Louis Beaumont1289f51e16d1
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsxindex 91f5ad56c..7ed739958 100644--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx@@ -574,12 +574,30 @@ export function PipesSection() {const togglePipe = async (name: string, enabled: boolean) => {posthog.capture("pipe_toggled", { pipe: name, enabled });- await fetch(`http://localhost:3030/pipes/${name}/enable`, {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ enabled }),- });- fetchPipes();+ // Optimistic update — flip the switch immediately+ setPipes((prev) =>+ prev.map((p) =>+ p.config.name === name+ ? { ...p, config: { ...p.config, enabled } }+ : p+ )+ );+ try {+ await fetch(`http://localhost:3030/pipes/${name}/enable`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ enabled }),+ });+ } catch {+ // Revert on failure+ setPipes((prev) =>+ prev.map((p) =>+ p.config.name === name+ ? { ...p, config: { ...p.config, enabled: !enabled } }+ : p+ )+ );+ }};const runPipe = async (name: string) => {