From 9bd481e6a908291bb398243acd5ccc92b805c450 Mon Sep 17 00:00:00 2001 From: abhinav-grd Date: Wed, 22 Sep 2021 19:04:55 +0530 Subject: [PATCH 1/2] set non-EmptyCollection as localCollection removed collection whose sync was pending --- src/pages/gallery/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 7a7d55d32..dc8c7e6cf 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -23,7 +23,6 @@ import { getFavItemIds, getLocalCollections, getNonEmptyCollections, - setLocalCollection, } from 'services/collectionService'; import constants from 'utils/strings/constants'; import billingService from 'services/billingService'; @@ -295,7 +294,6 @@ export default function Gallery() { collectionFilesCount.set(id, files.length); } setCollections(nonEmptyCollections); - setLocalCollection(nonEmptyCollections); setCollectionsAndTheirLatestFile(collectionsAndTheirLatestFile); setCollectionFilesCount(collectionFilesCount); const favItemIds = await getFavItemIds(files); From 1fe6875a14be364b1fc86fc8417c28e68b14290f Mon Sep 17 00:00:00 2001 From: abhinav-grd Date: Wed, 22 Sep 2021 19:05:53 +0530 Subject: [PATCH 2/2] first set collections and then its updation time ,to prevent bad state of time updated by collections not persisted --- src/services/collectionService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/collectionService.ts b/src/services/collectionService.ts index a5ca51f46..ea6b69ee9 100644 --- a/src/services/collectionService.ts +++ b/src/services/collectionService.ts @@ -198,8 +198,8 @@ export const syncCollections = async () => { } collections.sort((a, b) => b.updationTime - a.updationTime); collections.sort((a, b) => (b.type === CollectionType.favorites ? 1 : 0)); - await localForage.setItem(COLLECTION_UPDATION_TIME, updationTime); await localForage.setItem(COLLECTIONS, collections); + await localForage.setItem(COLLECTION_UPDATION_TIME, updationTime); return collections; };