diff --git a/src/components/Sidebar/ShortcutSection.tsx b/src/components/Sidebar/ShortcutSection.tsx
index d12e1ee55..4c7e080c0 100644
--- a/src/components/Sidebar/ShortcutSection.tsx
+++ b/src/components/Sidebar/ShortcutSection.tsx
@@ -1,11 +1,7 @@
-import React, { useContext } from 'react';
+import React, { useContext, useRef, useEffect } from 'react';
import constants from 'utils/strings/constants';
import { GalleryContext } from 'pages/gallery';
-import {
- ARCHIVE_SECTION,
- TRASH_SECTION,
- UNCATEGORIZED_SECTION,
-} from 'constants/collection';
+import { ARCHIVE_SECTION, TRASH_SECTION } from 'constants/collection';
import { CollectionSummaries } from 'types/collection';
import ShortcutButton from './ShortcutButton';
import DeleteOutline from '@mui/icons-material/DeleteOutline';
@@ -22,10 +18,23 @@ export default function ShortcutSection({
collectionSummaries,
}: Iprops) {
const galleryContext = useContext(GalleryContext);
+ const unCategorizedCollectionId = useRef(0);
+ useEffect(() => {
+ const UncategorizedSection = async () => {
+ const uncategorisedCollection = await getUncategorizedCollection();
+ unCategorizedCollectionId.current = uncategorisedCollection.id;
+ console.log(unCategorizedCollectionId.current);
+ console.log('hi');
+ };
+ return () => {
+ UncategorizedSection;
+ };
+ }, []);
const openUncategorizedSection = async () => {
const uncategorisedCollection = await getUncategorizedCollection();
- galleryContext.setActiveCollection(uncategorisedCollection.id);
+ unCategorizedCollectionId.current = uncategorisedCollection.id;
+ galleryContext.setActiveCollection(unCategorizedCollectionId.current);
closeSidebar();
};
@@ -38,16 +47,16 @@ export default function ShortcutSection({
galleryContext.setActiveCollection(ARCHIVE_SECTION);
closeSidebar();
};
-
return (
<>
}
label={constants.UNCATEGORIZED}
- count={
- collectionSummaries.get(UNCATEGORIZED_SECTION)?.fileCount
- }
onClick={openUncategorizedSection}
+ count={
+ collectionSummaries.get(unCategorizedCollectionId.current)
+ .fileCount
+ }
/>
}
diff --git a/src/constants/collection/index.ts b/src/constants/collection/index.ts
index aeaf58874..2d9f4636e 100644
--- a/src/constants/collection/index.ts
+++ b/src/constants/collection/index.ts
@@ -1,6 +1,5 @@
-export const UNCATEGORIZED_SECTION = -1;
-export const ARCHIVE_SECTION = -2;
-export const TRASH_SECTION = -3;
+export const ARCHIVE_SECTION = -1;
+export const TRASH_SECTION = -2;
export const ALL_SECTION = 0;
export enum CollectionType {
folder = 'folder',
diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx
index 1deb6a46b..54082c4e7 100644
--- a/src/pages/gallery/index.tsx
+++ b/src/pages/gallery/index.tsx
@@ -59,7 +59,6 @@ import PlanSelector from 'components/pages/gallery/PlanSelector';
import Uploader from 'components/Upload/Uploader';
import {
ALL_SECTION,
- UNCATEGORIZED_SECTION,
ARCHIVE_SECTION,
CollectionType,
TRASH_SECTION,
@@ -314,9 +313,7 @@ export default function Gallery() {
let collectionURL = '';
if (activeCollection !== ALL_SECTION) {
collectionURL += '?collection=';
- if (activeCollection === UNCATEGORIZED_SECTION) {
- collectionURL += constants.UNCATEGORIZED;
- } else if (activeCollection === ARCHIVE_SECTION) {
+ if (activeCollection === ARCHIVE_SECTION) {
collectionURL += constants.ARCHIVE;
} else if (activeCollection === TRASH_SECTION) {
collectionURL += constants.TRASH;