diff --git a/src/util/create-hooks.svelte.ts b/src/util/create-hooks.svelte.ts index b0caec65e..9226dbd47 100644 --- a/src/util/create-hooks.svelte.ts +++ b/src/util/create-hooks.svelte.ts @@ -61,7 +61,7 @@ export type PointerDateTime = Writable<{ type?: "dateTime" | "date" | undefined; }>; -function useTasks(props: { +export function useTasks(props: { settingsStore: Writable; combinedIcalSyncTrigger: Readable; debouncedTaskUpdateTrigger: Readable; @@ -71,6 +71,7 @@ function useTasks(props: { visibleDays: Readable; layoutReady: Readable; dataviewFacade: DataviewFacade; + // todo: replace with metadata cache app: App; dataviewSource: Readable; currentTime: Readable; @@ -210,6 +211,7 @@ function useTasks(props: { tasksForToday, currentTime, }); + return { tasksWithActiveClockProps, getDisplayedTasksWithClocksForTimeline, diff --git a/src/util/scheduler.ts b/src/util/scheduler.ts index 29cf9d269..6f363d974 100644 --- a/src/util/scheduler.ts +++ b/src/util/scheduler.ts @@ -29,6 +29,10 @@ const cancelJob = clearTimeout(id); }); +/** + * A scheduler accepts a list of tasks (a batch) and reports back when all of them are done. + * If a new batch of tasks is added, the scheduler will discard the previous batch and run the new one. + */ export function createBackgroundBatchScheduler( onFinish: (results: T[]) => void, ) { @@ -54,13 +58,6 @@ export function createBackgroundBatchScheduler( if (tasks.length > 0) { currentTaskHandle = enqueueJob(runTaskQueue); } else { - performance.mark("batch-end"); - // const { duration } = performance.measure( - // "batch", - // "batch-start", - // "batch-end", - // ); - onFinish(results); currentTaskHandle = null; }