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

Function resolvePaneFolderForTitle

public/js/fileListView.js:2314–2345  ·  view source on GitHub ↗
(paneKey, { fallbackToCurrent = false } = {})

Source from the content-addressed store, hash-verified

2312}
2313
2314function resolvePaneFolderForTitle(paneKey, { fallbackToCurrent = false } = {}) {
2315 if (!paneKey) return '';
2316 let folder = '';
2317 let sourceId = '';
2318 try {
2319 const state = getPaneState(paneKey);
2320 folder = (state && typeof state.currentFolder === 'string')
2321 ? state.currentFolder.trim()
2322 : '';
2323 sourceId = (state && typeof state.sourceId === 'string')
2324 ? state.sourceId.trim()
2325 : '';
2326 } catch (e) {
2327 folder = '';
2328 }
2329
2330 if (!folder) {
2331 const id = sourceId || getPaneSourceId(paneKey);
2332 folder = readStoredPaneFolder(paneKey, id);
2333 }
2334
2335 if (!folder && fallbackToCurrent) {
2336 const id = sourceId || getPaneSourceId(paneKey);
2337 if (id) {
2338 folder = getLastOpenedFolder(id) || 'root';
2339 } else {
2340 folder = window.currentFolder || getLastOpenedFolder(id) || 'root';
2341 }
2342 }
2343
2344 return folder || '';
2345}
2346
2347function refreshPaneTitlesFromState() {
2348 ensurePaneState();

Callers 1

Calls 4

getPaneStateFunction · 0.85
getPaneSourceIdFunction · 0.85
readStoredPaneFolderFunction · 0.85
getLastOpenedFolderFunction · 0.70

Tested by

no test coverage detected