Devide update into steps for better async behaviour
This commit is contained in:
+8
-2
@@ -757,7 +757,11 @@ local function runScrollableGrid(options)
|
|||||||
end
|
end
|
||||||
|
|
||||||
renderGrid()
|
renderGrid()
|
||||||
|
|
||||||
|
if options.shouldStartRefreshImmediately == nil or options.shouldStartRefreshImmediately(entries, counts) then
|
||||||
startRefreshJob()
|
startRefreshJob()
|
||||||
|
end
|
||||||
|
|
||||||
refreshTimer = os.startTimer(options.refreshSeconds or 30)
|
refreshTimer = os.startTimer(options.refreshSeconds or 30)
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
@@ -874,6 +878,7 @@ local function drawPage(base_id)
|
|||||||
|
|
||||||
runScrollableGrid({
|
runScrollableGrid({
|
||||||
refreshSeconds = 5,
|
refreshSeconds = 5,
|
||||||
|
refreshStepSeconds = 0.02,
|
||||||
getInitialEntries = function()
|
getInitialEntries = function()
|
||||||
return pageItems
|
return pageItems
|
||||||
end,
|
end,
|
||||||
@@ -881,7 +886,7 @@ local function drawPage(base_id)
|
|||||||
return makeZeroCounts(pageItemIds)
|
return makeZeroCounts(pageItemIds)
|
||||||
end,
|
end,
|
||||||
createRefreshJob = function(currentEntries)
|
createRefreshJob = function(currentEntries)
|
||||||
local job = createAsyncMeItemCountsJob(pageItemIds, 3)
|
local job = createAsyncMeItemCountsJob(pageItemIds, 1)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
step = function()
|
step = function()
|
||||||
@@ -945,6 +950,7 @@ drawOverview = function()
|
|||||||
|
|
||||||
runScrollableGrid({
|
runScrollableGrid({
|
||||||
refreshSeconds = 30,
|
refreshSeconds = 30,
|
||||||
|
refreshStepSeconds = 0.02,
|
||||||
getInitialEntries = function()
|
getInitialEntries = function()
|
||||||
if overviewCachedSortedItemIds and #overviewCachedSortedItemIds > 0 then
|
if overviewCachedSortedItemIds and #overviewCachedSortedItemIds > 0 then
|
||||||
return overviewCachedSortedItemIds
|
return overviewCachedSortedItemIds
|
||||||
@@ -963,7 +969,7 @@ drawOverview = function()
|
|||||||
overviewScrollTargetRow = targetRow
|
overviewScrollTargetRow = targetRow
|
||||||
end,
|
end,
|
||||||
createRefreshJob = function()
|
createRefreshJob = function()
|
||||||
local job = createAsyncMeItemCountsJob(items, 6)
|
local job = createAsyncMeItemCountsJob(items, 1)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
step = function()
|
step = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user