fix (sidebar): improve edge case

The initial assumption used to be that we must have a folder entry in the
sidebar but this assumption fails when we have a folder with hundreds or
more folders in which case we do not display the whole thing and errors
would get thrown which from a debugging standpoint was confusing as it
would let the dev think there is an uncatch issue
This commit is contained in:
MickaelK 2025-11-20 11:06:33 +11:00
parent d83638ae95
commit 0f3173a1fe

View file

@ -21,11 +21,10 @@ export default async function ctrlNavigationPane(render, { $sidebar, path }) {
dirname, dirname,
}); });
if (cpath === "/") $fs.appendChild($ul); if (cpath === "/") $fs.appendChild($ul);
else try { else {
qs($fs, `[data-path="${CSS.escape(cpath)}"] ul`).appendChild($ul); const $menuitem = $fs.querySelector(`[data-path="${CSS.escape(cpath)}"] ul`);
} catch (err) { if (!$menuitem) break;
console.error(chunks[i], dirname, err); $menuitem.appendChild($ul);
break;
} }
} }
render($fs); render($fs);
@ -46,10 +45,7 @@ export default async function ctrlNavigationPane(render, { $sidebar, path }) {
display(await _createListOfFiles(path, {})); display(await _createListOfFiles(path, {}));
}), }),
rxjs.catchError((err) => { rxjs.catchError((err) => {
if (err instanceof DOMException) { if (err instanceof DOMException) return rxjs.EMPTY;
console.error(err);
return rxjs.EMPTY;
}
return ctrlError()(err); return ctrlError()(err);
}), }),
)); ));