From 0f3173a1fe09ce8a5eac0c7a67d876d0cf7fae6a Mon Sep 17 00:00:00 2001 From: MickaelK Date: Thu, 20 Nov 2025 11:06:33 +1100 Subject: [PATCH] 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 --- public/assets/components/sidebar_files.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/public/assets/components/sidebar_files.js b/public/assets/components/sidebar_files.js index 2b735f97..e64689ce 100644 --- a/public/assets/components/sidebar_files.js +++ b/public/assets/components/sidebar_files.js @@ -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); }), ));