From d9a00dd157fbff6e833f37dd32b77900044e9f1c Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 19 Oct 2025 22:25:55 +0200 Subject: [PATCH] fix: merge reading progress from controller into reads/links before filtering - Enrich reads and links arrays with reading progress from readingProgressMap - Use item.id to lookup progress for articles - Use item.url to lookup progress for links - Now 'started' and 'reading' filters show correct articles - Filters respond in real-time as reading progress updates from controller --- src/components/Me.tsx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/components/Me.tsx b/src/components/Me.tsx index dc78f12f..f8f68346 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -499,9 +499,30 @@ const Me: React.FC = ({ const groups = groupIndividualBookmarks(filteredBookmarks) + // Enrich reads and links with reading progress from controller + const readsWithProgress = reads.map(item => { + if (item.type === 'article' && item.author) { + const progress = readingProgressMap.get(item.id) + if (progress !== undefined) { + return { ...item, readingProgress: progress } + } + } + return item + }) + + const linksWithProgress = links.map(item => { + if (item.url) { + const progress = readingProgressMap.get(item.url) + if (progress !== undefined) { + return { ...item, readingProgress: progress } + } + } + return item + }) + // Apply reading progress filter - const filteredReads = filterByReadingProgress(reads, readingProgressFilter, highlights) - const filteredLinks = filterByReadingProgress(links, readingProgressFilter, highlights) + const filteredReads = filterByReadingProgress(readsWithProgress, readingProgressFilter, highlights) + const filteredLinks = filterByReadingProgress(linksWithProgress, readingProgressFilter, highlights) const sections: Array<{ key: string; title: string; items: IndividualBookmark[] }> = groupingMode === 'flat' ? [{ key: 'all', title: `All Bookmarks (${filteredBookmarks.length})`, items: filteredBookmarks }]