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
perf: reduce unnecessary SwiftUI re-renders in notification timer
Louis Beaumont1efdb479245f
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swiftindex ee8c83483..eccdddf06 100644--- a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift+++ b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift@@ -605,12 +605,19 @@ class NotificationPanelController: NSObject {timer = Timer.scheduledTimer(withTimeInterval: 0.05, repeats: true) { [weak self] _ inguard let self = self else { return }// Stop if a newer notification replaced this one- guard self.epoch == currentEpoch else { return }+ guard self.epoch == currentEpoch else {+ self.timer?.invalidate()+ self.timer = nil+ return+ }if self.isHovered { return }let elapsed = self.elapsedBeforePause + Date().timeIntervalSince(self.resumedAt) * 1000let remaining = max(0, 1.0 - elapsed / self.autoDismissMs)- self.progress = remaining- self.updateContent()+ // Only re-render when progress changes visibly (>0.5% delta)+ if abs(self.progress - remaining) > 0.005 || remaining <= 0 {+ self.progress = remaining+ self.updateContent()+ }if remaining <= 0 {self.hide()self.sendAction("{\"type\":\"auto_dismiss\"}")@@ -627,10 +634,6 @@ class NotificationPanelController: NSObject {// MARK: - C FFI-private func makeCString(_ str: String) -> UnsafeMutablePointer<CChar> {- return strdup(str)!-}-@_cdecl("notif_free_string")public func notifFreeString(_ ptr: UnsafeMutablePointer<CChar>?) {if let ptr = ptr { free(ptr) }