From d2c1255a1c03362d2c00b6929876a67a220742cb Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 9 Jan 2025 09:38:07 +0530 Subject: [PATCH] [web] Fix navbar in uncategorized section --- .../new/photos/components/gallery/reducer.ts | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts index cc20ab6f7b..b78ca9e1d3 100644 --- a/web/packages/new/photos/components/gallery/reducer.ts +++ b/web/packages/new/photos/components/gallery/reducer.ts @@ -1042,6 +1042,18 @@ const deriveCollectionSummaries = ( files, ); + const uncategorizedCollection = collections.find( + ({ type }) => type === CollectionType.uncategorized, + ); + if (!uncategorizedCollection) { + collectionSummaries.set(DUMMY_UNCATEGORIZED_COLLECTION, { + ...pseudoCollectionOptionsForFiles([]), + id: DUMMY_UNCATEGORIZED_COLLECTION, + type: "uncategorized", + name: t("section_uncategorized"), + }); + } + const allSectionFiles = findAllSectionVisibleFiles( files, archivedCollectionIDs, @@ -1118,12 +1130,7 @@ const createCollectionSummaries = ( const filesByCollection = groupFilesByCollectionID(files); const coverFiles = findCoverFiles(collections, filesByCollection); - let hasUncategorizedCollection = false; for (const collection of collections) { - if (collection.type === CollectionType.uncategorized) { - hasUncategorizedCollection = true; - } - let type: CollectionSummaryType; if (isIncomingShare(collection, user)) { if (isIncomingCollabShare(collection, user)) { @@ -1184,15 +1191,6 @@ const createCollectionSummaries = ( }); } - if (!hasUncategorizedCollection) { - collectionSummaries.set(DUMMY_UNCATEGORIZED_COLLECTION, { - ...pseudoCollectionOptionsForFiles([]), - id: DUMMY_UNCATEGORIZED_COLLECTION, - type: "uncategorized", - name: t("section_uncategorized"), - }); - } - return collectionSummaries; };