fix: ensure bookmarks are sorted newest first after merging lists

- Re-sort all individual bookmarks after flattening from multiple lists
- Sort by added_at first, then fall back to created_at
- Prevents interleaving of sorted lists from breaking overall order
- Ensures newest bookmarks always appear at the top
This commit is contained in:
Gigi
2025-10-07 05:25:50 +01:00
parent fd28a6e171
commit 744642e2b7

View File

@@ -37,9 +37,10 @@ export const BookmarkList: React.FC<BookmarkListProps> = ({
loading = false
}) => {
// Merge and flatten all individual bookmarks from all lists
// They're already sorted by date in the service layer
// Re-sort after flattening to ensure newest first across all lists
const allIndividualBookmarks = bookmarks.flatMap(b => b.individualBookmarks || [])
.filter(ib => ib.content || ib.kind === 30023 || ib.kind === 39701)
.sort((a, b) => ((b.added_at || 0) - (a.added_at || 0)) || ((b.created_at || 0) - (a.created_at || 0)))
if (isCollapsed) {
// Check if the selected URL is in bookmarks