MCPcopy Create free account
hub / github.com/codeHappyDananx/SpecWave / queueTaskProgressLoad

Function queueTaskProgressLoad

src/stores/project.ts:307–331  ·  view source on GitHub ↗
(token: number)

Source from the content-addressed store, hash-verified

305 }
306
307 function queueTaskProgressLoad(token: number) {
308 const activeChanges = changesTree.value.filter(n => n.name !== 'archive')
309 const pending = activeChanges.filter(node => !taskProgressCache.has(normalizePath(node.path)))
310 const initialNodes = pending.slice(0, TASK_PROGRESS_INITIAL_BATCH)
311 const remaining = pending.slice(TASK_PROGRESS_INITIAL_BATCH)
312
313 void loadTaskProgressForNodes(initialNodes, 'initial')
314
315 if (remaining.length === 0) return
316 let index = 0
317 const batchSize = TASK_PROGRESS_INITIAL_BATCH
318
319 const runBatch = async () => {
320 if (token !== loadToken) return
321 const slice = remaining.slice(index, index + batchSize)
322 if (slice.length === 0) return
323 await loadTaskProgressForNodes(slice, 'background')
324 index += batchSize
325 if (index < remaining.length) {
326 window.setTimeout(runBatch, 120)
327 }
328 }
329
330 window.setTimeout(runBatch, 120)
331 }
332
333 function scheduleProjectReload(reason: string) {
334 if (reloadTimer !== null) {

Callers 2

loadFullTreeFunction · 0.85
loadProjectFunction · 0.85

Calls 2

normalizePathFunction · 0.85
loadTaskProgressForNodesFunction · 0.85

Tested by

no test coverage detected