Skip to content

armgit / ente

Public Imported from GitHub
0

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

Also colln

Manav Rathi8575bd83acec
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index f3ac058178..59e20d0f42 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -122,7 +122,7 @@ export interface GalleryState {
/*--< Primary state: Files, collections, people >--*/
/**
- * The user's non-hidden collections.
+ * The user's normal (non-hidden) collections.
*/
collections: Collection[];
/**
diff --git a/web/packages/new/photos/services/sync.ts b/web/packages/new/photos/services/sync.ts
index eaf08b949d..7a50b461c1 100644
--- a/web/packages/new/photos/services/sync.ts
+++ b/web/packages/new/photos/services/sync.ts
@@ -1,4 +1,5 @@
import { resetFileViewerDataSourceOnClose } from "@/gallery/components/viewer/data-source";
+import type { Collection } from "@/media/collection";
import type { EnteFile } from "@/media/file";
import { isHiddenCollection } from "@/new/photos/services/collection";
import {
@@ -46,21 +47,30 @@ export const sync = async () => {
interface SyncFilesAndCollectionsOpts {
/**
- * Called when saved normal files were replaced by the given {@link files}.
+ * Called when saved collections, both normal and hidden, are (potentially)
+ * updated.
*/
- onResetFiles: (files: EnteFile[]) => void;
+ onSetCollections: (
+ normalCollections: Collection[],
+ hiddenCollections: Collection[],
+ ) => void;
/**
- * Called when saved normal files were augmented with the newly fetched
- * {@link files}.
+ * Called when saved normal (non-hidden, non-trash) files were replaced by
+ * the given {@link files}.
*/
- onFetchFiles: (files: EnteFile[]) => void;
+ onResetNormalFiles: (files: EnteFile[]) => void;
+ /**
+ * Called when saved normal files were augmented with the given newly
+ * fetched {@link files}.
+ */
+ onFetchNormalFiles: (files: EnteFile[]) => void;
/**
* Called when saved hidden files were replaced by the given {@link files}.
*/
onResetHiddenFiles: (files: EnteFile[]) => void;
/**
- * Called when saved hidden files were augmented with the newly fetched
- * {@link files}.
+ * Called when saved hidden files were augmented with the given newly
+ * fetched {@link files}.
*/
onFetchHiddenFiles: (files: EnteFile[]) => void;
/**
@@ -93,11 +103,12 @@ export const syncFilesAndCollections = async (
allCollections,
isHiddenCollection,
);
+ opts?.onSetCollections(normalCollections, hiddenCollections);
const didUpdateNormalFiles = await syncFiles(
"normal",
normalCollections,
- opts?.onResetFiles,
- opts?.onFetchFiles,
+ opts?.onResetNormalFiles,
+ opts?.onFetchNormalFiles,
);
const didUpdateHiddenFiles = await syncFiles(
"hidden",