Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fin

Manav Rathi84f263adac0c
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 420202887f..2a688e2638 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -857,7 +857,9 @@ export default function Gallery() {
(hiddenFiles) =>
dispatch({ type: "fetchHiddenFiles", hiddenFiles }),
);
- await syncTrash(allCollections, setTrashedFiles);
+ await syncTrash(allCollections, (trashedFiles: EnteFile[]) =>
+ dispatch({ type: "setTrashedFiles", trashedFiles }),
+ );
// syncWithRemote is called with the force flag set to true before
// doing an upload. So it is possible, say when resuming a pending
// upload, that we get two syncWithRemotes happening in parallel.
diff --git a/web/apps/photos/src/services/trashService.ts b/web/apps/photos/src/services/trashService.ts
index 1a6beaf3a5..802cf4f2ab 100644
--- a/web/apps/photos/src/services/trashService.ts
+++ b/web/apps/photos/src/services/trashService.ts
@@ -1,7 +1,7 @@
import log from "@/base/log";
import { apiURL } from "@/base/origins";
import type { Collection } from "@/media/collection";
-import { EncryptedTrashItem, Trash } from "@/media/file";
+import { EncryptedTrashItem, Trash, type EnteFile } from "@/media/file";
import {
getLocalTrash,
getTrashedFiles,
@@ -10,7 +10,6 @@ import {
import HTTPService from "@ente/shared/network/HTTPService";
import localForage from "@ente/shared/storage/localForage";
import { getToken } from "@ente/shared/storage/localStorage/helpers";
-import { SetFiles } from "types/gallery";
import { decryptFile } from "utils/file";
import { getCollection } from "./collectionService";
@@ -45,7 +44,7 @@ async function getLastSyncTime() {
}
export async function syncTrash(
collections: Collection[],
- setTrashedFiles: SetFiles,
+ setTrashedFiles: (fs: EnteFile[]) => void,
): Promise<void> {
const trash = await getLocalTrash();
collections = [...collections, ...(await getLocalDeletedCollections())];
@@ -69,7 +68,7 @@ export async function syncTrash(
export const updateTrash = async (
collections: Map<number, Collection>,
sinceTime: number,
- setTrashedFiles: SetFiles,
+ setTrashedFiles: (fs: EnteFile[]) => void,
currentTrash: Trash,
): Promise<Trash> => {
try {
diff --git a/web/apps/photos/src/types/gallery/index.ts b/web/apps/photos/src/types/gallery/index.ts
index 79fa715173..29ff3e6d7b 100644
--- a/web/apps/photos/src/types/gallery/index.ts
+++ b/web/apps/photos/src/types/gallery/index.ts
@@ -1,4 +1,3 @@
-import { EnteFile } from "@/media/file";
import { type SelectionContext } from "@/new/photos/components/gallery";
import type { User } from "@ente/shared/user/types";
import { FilesDownloadProgressAttributes } from "components/FilesDownloadProgress";
@@ -19,7 +18,6 @@ export type SelectedState = {
export type SetSelectedState = React.Dispatch<
React.SetStateAction<SelectedState>
>;
-export type SetFiles = React.Dispatch<React.SetStateAction<EnteFile[]>>;
export type SetLoading = React.Dispatch<React.SetStateAction<boolean>>;
export type SetFilesDownloadProgressAttributes = (
value: