remove archived local state

This commit is contained in:
abhinav-grd 2021-09-22 15:57:56 +05:30
parent 609a7bb989
commit e3021dcf55
2 changed files with 1 additions and 13 deletions

View file

@ -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)) {

View file

@ -176,7 +176,6 @@ export default function Gallery() {
const syncInProgress = useRef(true);
const resync = useRef(false);
const [deleted, setDeleted] = useState<number[]>([]);
const [archived, setArchived] = useState<number[]>([]);
const appContext = useContext(AppContext);
const [collectionFilesCount, setCollectionFilesCount] =
useState<Map<number, number>>();
@ -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}