Devide update into steps for better async behaviour

This commit is contained in:
Max
2026-06-01 15:18:35 +02:00
parent 514c7e9b22
commit f8ad2a6439
+9 -3
View File
@@ -757,7 +757,11 @@ local function runScrollableGrid(options)
end
renderGrid()
startRefreshJob()
if options.shouldStartRefreshImmediately == nil or options.shouldStartRefreshImmediately(entries, counts) then
startRefreshJob()
end
refreshTimer = os.startTimer(options.refreshSeconds or 30)
while true do
@@ -874,6 +878,7 @@ local function drawPage(base_id)
runScrollableGrid({
refreshSeconds = 5,
refreshStepSeconds = 0.02,
getInitialEntries = function()
return pageItems
end,
@@ -881,7 +886,7 @@ local function drawPage(base_id)
return makeZeroCounts(pageItemIds)
end,
createRefreshJob = function(currentEntries)
local job = createAsyncMeItemCountsJob(pageItemIds, 3)
local job = createAsyncMeItemCountsJob(pageItemIds, 1)
return {
step = function()
@@ -945,6 +950,7 @@ drawOverview = function()
runScrollableGrid({
refreshSeconds = 30,
refreshStepSeconds = 0.02,
getInitialEntries = function()
if overviewCachedSortedItemIds and #overviewCachedSortedItemIds > 0 then
return overviewCachedSortedItemIds
@@ -963,7 +969,7 @@ drawOverview = function()
overviewScrollTargetRow = targetRow
end,
createRefreshJob = function()
local job = createAsyncMeItemCountsJob(items, 6)
local job = createAsyncMeItemCountsJob(items, 1)
return {
step = function()