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