From 2c0ba89c33e7f72ef9abdb2683826cca6cdb8e0c Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 3 Feb 2021 13:44:37 +0530 Subject: [PATCH] added updated collection not empty check --- src/pages/gallery/index.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 87131ebfa..c40b6e1ae 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -132,7 +132,7 @@ export default function Gallery(props) { useEffect(() => { const key = getKey(SESSION_KEYS.ENCRYPTION_KEY); const token = getToken(); - if (!key && token) { + if (!key || !token) { router.push('/'); } const main = async () => { @@ -143,10 +143,12 @@ export default function Gallery(props) { const collections = await getLocalCollections(); const collectionLatestFile = await getCollectionLatestFile(collections, token); const favItemIds = await getFavItemIds(data); - setCollections(collections); - setData(data); - setCollectionLatestFile(collectionLatestFile); - setFavItemIds(favItemIds); + if (updatedCollections.length > 0) { + setCollections(collections); + setData(data); + setCollectionLatestFile(collectionLatestFile); + setFavItemIds(favItemIds); + } setProgress(100); }; main();