This commit is contained in:
Manav Rathi
2025-06-24 08:13:51 +05:30
parent 86d09d997a
commit fbd0bf257e
2 changed files with 3 additions and 8 deletions

View File

@@ -214,7 +214,7 @@ export interface CollectionChange {
* will be at most one entry for a given collection in the result array. See:
* [Note: Diff response will have at most one entry for an id]
*/
export const getCollectionChanges = async (
export const getCollections = async (
sinceTime: number,
): Promise<CollectionChange[]> => {
const res = await fetch(

View File

@@ -1,6 +1,6 @@
import { type Collection } from "ente-media/collection";
import localForage from "ente-shared/storage/localForage";
import { getCollectionChanges, isHiddenCollection } from "./collection";
import { getCollections, isHiddenCollection } from "./collection";
import { savedCollections } from "./photos-fdb";
const COLLECTION_TABLE = "collections";
@@ -43,15 +43,10 @@ export const getLatestCollections = async (
};
export const getAllLatestCollections = async (): Promise<Collection[]> => {
const collections = await syncCollections();
return collections;
};
export const syncCollections = async () => {
const localCollections = await savedCollections();
let sinceTime = await getCollectionUpdationTime();
const changes = await getCollectionChanges(sinceTime);
const changes = await getCollections(sinceTime);
if (!changes.length) return localCollections;
const hiddenCollectionIDs = await getHiddenCollectionIDs();