From 5026a946f5b275f34400f01b428ee4c2c944bb1b Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sun, 28 Dec 2025 19:48:57 -0500 Subject: [PATCH] Reduce queue list jankiness during auto-refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented two key optimizations to smooth queue list updates: 1. Increased auto-refresh interval from 1000ms to 2000ms - Reduces frequency of view rebuilds - Gives UI more time to stabilize between updates 2. Reduced scroll restoration delay from 50ms to 10ms - Minimizes visible jump during position restoration - Saves offset to variable before goroutine to avoid race conditions These changes work together to provide a smoother queue viewing experience by reducing rebuild frequency while accelerating scroll position recovery. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 3c79503..fa457fd 100644 --- a/main.go +++ b/main.go @@ -1935,13 +1935,15 @@ func (s *appState) refreshQueueView() { // Restore scroll offset s.queueScroll = scroll if s.queueScroll != nil && s.active == "queue" { - // Use ScrollTo instead of directly setting Offset to prevent rubber banding - // Defer to allow UI to settle first + // Restore scroll position immediately to reduce jankiness + // Set offset before showing to avoid visible jumping + savedOffset := s.queueOffset go func() { - time.Sleep(50 * time.Millisecond) + // Minimal delay to allow layout calculation + time.Sleep(10 * time.Millisecond) fyne.CurrentApp().Driver().DoFromGoroutine(func() { if s.queueScroll != nil { - s.queueScroll.Offset = s.queueOffset + s.queueScroll.Offset = savedOffset s.queueScroll.Refresh() } }, false) @@ -1962,9 +1964,10 @@ func (s *appState) startQueueAutoRefresh() { s.queueAutoRefreshStop = stop s.queueAutoRefreshRunning = true go func() { - // Use 1-second interval to reduce UI update frequency, especially on Windows + // Use 2-second interval to reduce UI jankiness from frequent rebuilds + // Slower refresh = smoother experience, especially with scroll position preservation // The refreshQueueView method has its own 500ms throttle for other triggers - ticker := time.NewTicker(1000 * time.Millisecond) + ticker := time.NewTicker(2000 * time.Millisecond) defer ticker.Stop() for { select {