Reduce queue list jankiness during auto-refresh

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 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-28 19:48:57 -05:00
parent 3863242ba9
commit 5026a946f5

15
main.go
View File

@ -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 {