From d7b65052e11236474e91f39b1cbef9676f8a032f Mon Sep 17 00:00:00 2001 From: Reece Date: Thu, 20 Nov 2025 14:56:51 +0000 Subject: [PATCH] lint --- .../components/viewer/BookmarkSidebar.tsx | 23 ++++++++++--------- .../core/components/viewer/EmbedPdfViewer.tsx | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/frontend/src/core/components/viewer/BookmarkSidebar.tsx b/frontend/src/core/components/viewer/BookmarkSidebar.tsx index c36c90a22d..c35198f8b5 100644 --- a/frontend/src/core/components/viewer/BookmarkSidebar.tsx +++ b/frontend/src/core/components/viewer/BookmarkSidebar.tsx @@ -309,17 +309,18 @@ export const BookmarkSidebar = ({ visible, thumbnailVisible, documentCacheKey, p const term = searchTerm.trim().toLowerCase(); const applyFilter = (nodeList: BookmarkNode[]): BookmarkNode[] => { - return nodeList - .map(node => { - const childMatches = node.children ? applyFilter(node.children as BookmarkNode[]) : []; - const matchesSelf = node.title?.toLowerCase().includes(term) ?? false; + const results: BookmarkNode[] = []; - if (matchesSelf || childMatches.length > 0) { - return { ...node, children: childMatches.length > 0 ? childMatches : node.children }; - } - return null; - }) - .filter((node): node is BookmarkNode => node !== null); + for (const node of nodeList) { + const childMatches = node.children ? applyFilter(node.children as BookmarkNode[]) : []; + const matchesSelf = node.title?.toLowerCase().includes(term) ?? false; + + if (matchesSelf || childMatches.length > 0) { + results.push({ ...node, children: childMatches.length > 0 ? childMatches : node.children }); + } + } + + return results; }; return applyFilter(bookmarksWithIds); @@ -330,7 +331,7 @@ export const BookmarkSidebar = ({ visible, thumbnailVisible, documentCacheKey, p return null; } - return nodes.map((node, index) => { + return nodes.map((node, _index) => { if (!node || !node.id) { return null; } diff --git a/frontend/src/core/components/viewer/EmbedPdfViewer.tsx b/frontend/src/core/components/viewer/EmbedPdfViewer.tsx index 91dc25e979..5a7711e26c 100644 --- a/frontend/src/core/components/viewer/EmbedPdfViewer.tsx +++ b/frontend/src/core/components/viewer/EmbedPdfViewer.tsx @@ -138,7 +138,7 @@ const EmbedPdfViewerContent = ({ }, [previewFile, fileWithUrl]); const bookmarkCacheKey = React.useMemo(() => { - if (isStirlingFile(currentFile)) { + if (currentFile && isStirlingFile(currentFile)) { return currentFile.fileId; }