This commit is contained in:
Reece
2025-11-20 14:56:51 +00:00
parent 52f1608a11
commit d7b65052e1
2 changed files with 13 additions and 12 deletions
@@ -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;
}
@@ -138,7 +138,7 @@ const EmbedPdfViewerContent = ({
}, [previewFile, fileWithUrl]);
const bookmarkCacheKey = React.useMemo(() => {
if (isStirlingFile(currentFile)) {
if (currentFile && isStirlingFile(currentFile)) {
return currentFile.fileId;
}