MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / prefetch

Function prefetch

src/hooks/useAsyncImageCache.ts:306–321  ·  view source on GitHub ↗

* Prefetch items for a list of images. * Uses bulk mode for faster initial loading with bounded yielding batches. * Uses batched progress updates to avoid excessive re-renders.

(
      images: Array<{ file: File; name: string }>,
      onProgress?: (progress: number) => void
    )

Source from the content-addressed store, hash-verified

304 * Uses batched progress updates to avoid excessive re-renders.
305 */
306 async prefetch(
307 images: Array<{ file: File; name: string }>,
308 onProgress?: (progress: number) => void
309 ): Promise<void> {
310 await prefetchAsyncImages({
311 images,
312 onProgress,
313 cache: state.cache,
314 loadingPromises: state.loadingPromises,
315 queueLoad,
316 setBulkMode: (bulkMode) => {
317 state.bulkMode = bulkMode;
318 },
319 maxConcurrentLoads: MAX_CONCURRENT_LOADS,
320 });
321 },
322
323 /**
324 * Get current cache generation (for tracking cache clears).

Callers 1

flushBatchFunction · 0.85

Calls 1

prefetchAsyncImagesFunction · 0.90

Tested by

no test coverage detected