MCPcopy Create free account
hub / github.com/error311/FileRise / expandAndLoadSavedState

Function expandAndLoadSavedState

public/js/folderManager.js:2588–2609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2586 Expand saved state at boot
2587----------------------*/
2588async function expandAndLoadSavedState() {
2589 const st = loadFolderTreeState();
2590 const openKeys = Object.keys(st).filter(k => st[k] === 'block');
2591 openKeys.sort((a, b) => a.split('/').length - b.split('/').length);
2592
2593 for (const key of openKeys) {
2594 const ul = getULForFolder(key);
2595 if (!ul) continue;
2596 ul.classList.add('expanded');
2597 ul.classList.remove('collapsed');
2598
2599 let li;
2600 if (key === 'root') {
2601 li = document.getElementById('rootRow');
2602 } else {
2603 const opt = document.querySelector(`.folder-option[data-folder="${CSS.escape(key)}"]`);
2604 li = opt ? opt.closest('li[role="treeitem"]') : null;
2605 }
2606 if (li) li.setAttribute('aria-expanded', 'true');
2607 try { await ensureChildrenLoaded(key, ul); } catch (e) {}
2608 }
2609}
2610
2611/* ----------------------
2612 Main: loadFolderTree

Callers 5

syncTreeAfterFolderMoveFunction · 0.85
selectFolderFunction · 0.85
loadFolderTreeFunction · 0.85
renameFolderInlineFunction · 0.85
folderManager.jsFile · 0.85

Calls 4

loadFolderTreeStateFunction · 0.85
getULForFolderFunction · 0.85
ensureChildrenLoadedFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected