remove archived local state
This commit is contained in:
parent
609a7bb989
commit
e3021dcf55
|
@ -150,7 +150,6 @@ interface Props {
|
||||||
search: Search;
|
search: Search;
|
||||||
setSearchStats: setSearchStats;
|
setSearchStats: setSearchStats;
|
||||||
deleted?: number[];
|
deleted?: number[];
|
||||||
archived?: number[];
|
|
||||||
setDialogMessage: SetDialogMessage;
|
setDialogMessage: SetDialogMessage;
|
||||||
activeCollection: number;
|
activeCollection: number;
|
||||||
isSharedCollection: boolean;
|
isSharedCollection: boolean;
|
||||||
|
@ -170,7 +169,6 @@ const PhotoFrame = ({
|
||||||
search,
|
search,
|
||||||
setSearchStats,
|
setSearchStats,
|
||||||
deleted,
|
deleted,
|
||||||
archived,
|
|
||||||
setDialogMessage,
|
setDialogMessage,
|
||||||
activeCollection,
|
activeCollection,
|
||||||
isSharedCollection,
|
isSharedCollection,
|
||||||
|
@ -408,10 +406,7 @@ const PhotoFrame = ({
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (activeCollection === ALL_SECTION && fileIsArchived(item)) {
|
||||||
activeCollection === ALL_SECTION &&
|
|
||||||
(fileIsArchived(item) || archived.includes(item.id))
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (activeCollection === ARCHIVE_SECTION && !fileIsArchived(item)) {
|
if (activeCollection === ARCHIVE_SECTION && !fileIsArchived(item)) {
|
||||||
|
|
|
@ -176,7 +176,6 @@ export default function Gallery() {
|
||||||
const syncInProgress = useRef(true);
|
const syncInProgress = useRef(true);
|
||||||
const resync = useRef(false);
|
const resync = useRef(false);
|
||||||
const [deleted, setDeleted] = useState<number[]>([]);
|
const [deleted, setDeleted] = useState<number[]>([]);
|
||||||
const [archived, setArchived] = useState<number[]>([]);
|
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const [collectionFilesCount, setCollectionFilesCount] =
|
const [collectionFilesCount, setCollectionFilesCount] =
|
||||||
useState<Map<number, number>>();
|
useState<Map<number, number>>();
|
||||||
|
@ -380,7 +379,6 @@ export default function Gallery() {
|
||||||
VISIBILITY_STATE.ARCHIVED
|
VISIBILITY_STATE.ARCHIVED
|
||||||
);
|
);
|
||||||
await updateMagicMetadata(archivedFiles);
|
await updateMagicMetadata(archivedFiles);
|
||||||
setArchived([...archived, ...archivedFiles.map((file) => file.id)]);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
switch (e.status?.toString()) {
|
switch (e.status?.toString()) {
|
||||||
|
@ -415,10 +413,6 @@ export default function Gallery() {
|
||||||
VISIBILITY_STATE.VISIBLE
|
VISIBILITY_STATE.VISIBLE
|
||||||
);
|
);
|
||||||
await updateMagicMetadata(unarchiveFiles);
|
await updateMagicMetadata(unarchiveFiles);
|
||||||
const unarchiveFileIds = unarchiveFiles.map((file) => file.id);
|
|
||||||
setArchived(
|
|
||||||
archived.filter((id) => !unarchiveFileIds.includes(id))
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
switch (e.status?.toString()) {
|
switch (e.status?.toString()) {
|
||||||
case ServerErrorCodes.FORBIDDEN:
|
case ServerErrorCodes.FORBIDDEN:
|
||||||
|
@ -637,7 +631,6 @@ export default function Gallery() {
|
||||||
search={search}
|
search={search}
|
||||||
setSearchStats={setSearchStats}
|
setSearchStats={setSearchStats}
|
||||||
deleted={deleted}
|
deleted={deleted}
|
||||||
archived={archived}
|
|
||||||
setDialogMessage={setDialogMessage}
|
setDialogMessage={setDialogMessage}
|
||||||
activeCollection={activeCollection}
|
activeCollection={activeCollection}
|
||||||
isSharedCollection={isSharedCollectionActive}
|
isSharedCollection={isSharedCollectionActive}
|
||||||
|
|
Loading…
Reference in a new issue