fix too many location/history api request

This commit is contained in:
abhinav-grd 2021-09-30 18:54:29 +05:30
parent 361374c037
commit 5506806b29

View file

@ -182,7 +182,7 @@ export default function Gallery() {
const appContext = useContext(AppContext);
const [collectionFilesCount, setCollectionFilesCount] =
useState<Map<number, number>>();
const [activeCollection, setActiveCollection] = useState(0);
const [activeCollection, setActiveCollection] = useState<number>(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=';