MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / renderFiles

Function renderFiles

renderer.js:12407–12475  ·  view source on GitHub ↗
(files, skipThumbnail = false, viewEntireLibrary = false)

Source from the content-addressed store, hash-verified

12405 }
12406 break;
12407 }
12408 }
12409 } catch (updateError) {
12410 console.error(`[DEBUG] Error updating DOM for ${file.filePath}:`, updateError);
12411 }
12412 }, 300);
12413 }
12414 } else {
12415 console.log(`[DEBUG] No embedded images found in 3MF: ${file.filePath}`);
12416 }
12417 } catch (imageError) {
12418 console.error('Error checking for embedded image:', imageError);
12419 }
12420 }
12421
12422 if (!thumbnail) {
12423 thumbnail = await new Promise((resolve, reject) => {
12424 renderQueue.push({
12425 filePath: file.filePath,
12426 container: document.createElement('div'), // Dummy container
12427 existingThumbnail: null,
12428 resolve,
12429 reject,
12430 thumbPriority: THUMB_PRIORITY_BACKGROUND
12431 });
12432 processRenderQueue();
12433 });
12434
12435 if (thumbnail) {
12436 await window.electron.saveThumbnail(file.filePath, thumbnail);
12437 }
12438 }
12439
12440 // Calculate and save hash during thumbnail generation (file is already being read)
12441 if (!file.hash || file.hash === '') {
12442 try {
12443 await window.electron.calculateFileHash(file.filePath);
12444 } catch (hashError) {
12445 console.error(`Error calculating hash for ${file.filePath}:`, hashError);
12446 // Continue even if hash calculation fails
12447 }
12448 }
12449 } catch (error) {
12450 console.error('Error caching thumbnail:', error);
12451 } finally {
12452 if (!window._scanThumbnailProgress) {
12453 completedThumbnails++;
12454 thumbnailProgressUpdate(completedThumbnails);
12455 }
12456 activePromises.delete(promise);
12457 }
12458 })();
12459
12460 activePromises.add(promise);
12461 }
12462
12463 // Wait for at least one promise to complete before continuing
12464 if (activePromises.size > 0) {

Callers 9

renderer.jsFile · 0.85
refreshTagManagerListFunction · 0.85
closeHandlerFunction · 0.85
refreshMetadataListFunction · 0.85
forceGridRefreshFunction · 0.85
refreshUIContentFunction · 0.85
scanAndRenderDirectoryFunction · 0.85
handleDeleteSelectedFunction · 0.85

Calls 5

renderVirtualGridFunction · 0.85
updateModelCountsFunction · 0.85

Tested by

no test coverage detected