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

Function pruneParentModelExpandedGroups

renderer.js:1365–1383  ·  view source on GitHub ↗

Drop expand state for parent groups that no longer have 2+ distinct files.

(models)

Source from the content-addressed store, hash-verified

1363 if (!path) return '';
1364 // Decode URL encoding if present
1365 let normalized = path;
1366 try {
1367 normalized = decodeURIComponent(normalized);
1368 } catch (e) {
1369 // If decoding fails, use original path
1370 }
1371 // Normalize path separators (both forward and back slashes)
1372 normalized = normalized.replace(/\\/g, '/');
1373 // Trim whitespace
1374 normalized = normalized.trim();
1375 // Windows drive letter: compare case-insensitively (C: vs c:)
1376 if (/^[a-zA-Z]:\//.test(normalized)) {
1377 normalized = normalized.charAt(0).toUpperCase() + normalized.slice(1);
1378 }
1379 return normalized;
1380}
1381
1382/** Stable identity for grid rows: same file path = one row (handles duplicate DB ids). */
1383function getGridModelDedupeKey(model) {
1384 if (!model) return '';
1385 const pathNorm = normalizePathForComparison(model.filePath || '');
1386 if (pathNorm) return `p:${pathNorm}`;

Callers 1

renderVirtualGridFunction · 0.85

Calls 3

getParentModelGroupLabelFunction · 0.85
getParentModelGroupKeyFunction · 0.85

Tested by

no test coverage detected