Stop the sync poll from rebuilding the panel every 5 s

@Published fires even when the assigned value is unchanged, so the poll's
unconditional lastError = nil invalidated PanelView — which observes
SyncService — every 5 seconds, forever, hidden or visible. Over five days
that was ~185 CPU-minutes and ~190 MB, and clicks started to lag.

- Route poll state through setError, which skips equal values.
- Watch SyncService from a tiny SyncDot view instead of the panel body.
- Skip the URL cache on polls and give them timeouts.
- Only reassign the composer placeholder when it changed.
This commit is contained in:
2026-10-22 23:55:32 +08:00
parent 0a6ef314c0
commit d665d493af
4 changed files with 50 additions and 10 deletions
+3 -1
View File
@@ -67,7 +67,9 @@ struct ComposerView: NSViewRepresentable {
textView.string = text
updateHeight(textView)
}
textView.placeholderText = placeholder
if textView.placeholderText != placeholder {
textView.placeholderText = placeholder
}
if isFocused, scrollView.window?.firstResponder != textView {
scrollView.window?.makeFirstResponder(textView)
}