From 5915e928c3855720981257d0fec8cb9334c33f3d Mon Sep 17 00:00:00 2001 From: Max <33982882+maxboeer@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:13:21 +0200 Subject: [PATCH] Fix scrolling / update race condition --- compcount.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/compcount.lua b/compcount.lua index 8ae9d68..10bc4ad 100644 --- a/compcount.lua +++ b/compcount.lua @@ -731,6 +731,7 @@ local function runScrollableGrid(options) local targetScrollRow = 0 local refreshTimer local animationTimer + local pendingCacheSync = false local columns = 6 local rowsPerView = 6 @@ -902,12 +903,22 @@ local function runScrollableGrid(options) persistScrollState() renderGrid() + + if not animationTimer and pendingCacheSync then + pendingCacheSync = false + syncFromCache() + renderGrid() + end elseif event == "timer" then local handled, isDone = stepGlobalCountRefresh(p1) if handled and isDone then - syncFromCache() - renderGrid() + if animationTimer or math.abs(targetScrollRow - currentScrollRow) > 0.001 then + pendingCacheSync = true + else + syncFromCache() + renderGrid() + end end elseif event == "monitor_touch" and p1 == monName then if options.handleChromeTouch and options.handleChromeTouch(x, y) then