From 5506806b29afdd80eb1e834e6f3b5af1a57445a1 Mon Sep 17 00:00:00 2001 From: abhinav-grd Date: Thu, 30 Sep 2021 18:54:29 +0530 Subject: [PATCH] fix too many location/history api request --- src/pages/gallery/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 2cb99938e..3027d8631 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -182,7 +182,7 @@ export default function Gallery() { const appContext = useContext(AppContext); const [collectionFilesCount, setCollectionFilesCount] = useState>(); - const [activeCollection, setActiveCollection] = useState(0); + const [activeCollection, setActiveCollection] = useState(undefined); const [isSharedCollectionActive, setIsSharedCollectionActive] = useState(false); @@ -196,6 +196,7 @@ export default function Gallery() { return; } const main = async () => { + setActiveCollection(ALL_SECTION); setIsFirstLoad(isFirstLogin()); setIsFirstFetch(true); if (justSignedUp()) { @@ -232,6 +233,9 @@ export default function Gallery() { useEffect(() => setCollectionNamerView(true), [collectionNamerAttributes]); useEffect(() => { + if (typeof activeCollection === 'undefined') { + return; + } let collectionURL = ''; if (activeCollection !== ALL_SECTION) { collectionURL += '?collection=';