From e3021dcf5516969b28c46f143bcc041376f4f459 Mon Sep 17 00:00:00 2001 From: abhinav-grd Date: Wed, 22 Sep 2021 15:57:56 +0530 Subject: [PATCH] remove archived local state --- src/components/PhotoFrame.tsx | 7 +------ src/pages/gallery/index.tsx | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/components/PhotoFrame.tsx b/src/components/PhotoFrame.tsx index c2da4a6ab..faeae4cff 100644 --- a/src/components/PhotoFrame.tsx +++ b/src/components/PhotoFrame.tsx @@ -150,7 +150,6 @@ interface Props { search: Search; setSearchStats: setSearchStats; deleted?: number[]; - archived?: number[]; setDialogMessage: SetDialogMessage; activeCollection: number; isSharedCollection: boolean; @@ -170,7 +169,6 @@ const PhotoFrame = ({ search, setSearchStats, deleted, - archived, setDialogMessage, activeCollection, isSharedCollection, @@ -408,10 +406,7 @@ const PhotoFrame = ({ ) { return false; } - if ( - activeCollection === ALL_SECTION && - (fileIsArchived(item) || archived.includes(item.id)) - ) { + if (activeCollection === ALL_SECTION && fileIsArchived(item)) { return false; } if (activeCollection === ARCHIVE_SECTION && !fileIsArchived(item)) { diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 287fdd8a0..9faf0aef6 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -176,7 +176,6 @@ export default function Gallery() { const syncInProgress = useRef(true); const resync = useRef(false); const [deleted, setDeleted] = useState([]); - const [archived, setArchived] = useState([]); const appContext = useContext(AppContext); const [collectionFilesCount, setCollectionFilesCount] = useState>(); @@ -380,7 +379,6 @@ export default function Gallery() { VISIBILITY_STATE.ARCHIVED ); await updateMagicMetadata(archivedFiles); - setArchived([...archived, ...archivedFiles.map((file) => file.id)]); } catch (e) { console.log(e); switch (e.status?.toString()) { @@ -415,10 +413,6 @@ export default function Gallery() { VISIBILITY_STATE.VISIBLE ); await updateMagicMetadata(unarchiveFiles); - const unarchiveFileIds = unarchiveFiles.map((file) => file.id); - setArchived( - archived.filter((id) => !unarchiveFileIds.includes(id)) - ); } catch (e) { switch (e.status?.toString()) { case ServerErrorCodes.FORBIDDEN: @@ -637,7 +631,6 @@ export default function Gallery() { search={search} setSearchStats={setSearchStats} deleted={deleted} - archived={archived} setDialogMessage={setDialogMessage} activeCollection={activeCollection} isSharedCollection={isSharedCollectionActive}