Doc and tweak

This commit is contained in:
Manav Rathi
2025-06-24 09:55:31 +05:30
parent bf8713ba21
commit 124006929f
5 changed files with 15 additions and 13 deletions

View File

@@ -481,7 +481,7 @@ export const Upload: React.FC<UploadProps> = ({
setDesktopFilePaths([]);
setDesktopZipItems([]);
// Remove hidden files (files whose names begins with a ".").
// Filter out files whose names begins with a ".".
const prunedItemAndPaths = allItemAndPaths.filter(
([, p]) => !basename(p).startsWith("."),
);

View File

@@ -581,18 +581,11 @@ const deduceEvents = async (watches: FolderWatch[]): Promise<WatchEvent[]> => {
*/
const pathsToUpload = (paths: string[], watch: FolderWatch) =>
paths
// Filter out hidden files (files whose names begins with a dot)
.filter((path) => !isHiddenFile(path))
// Filter out files whose names begins with a dot.
.filter((path) => !basename(path).startsWith("."))
// Files that are on disk but not yet synced or ignored.
.filter((path) => !isSyncedOrIgnoredPath(path, watch));
/**
* Return true if the file at the given {@link path} is hidden.
*
* Hidden files are those whose names begin with a "." (dot).
*/
const isHiddenFile = (path: string) => basename(path).startsWith(".");
/**
* Return the paths to previously synced files that are no longer on disk and so
* must be removed from the Ente collection.

View File

@@ -33,6 +33,15 @@ export const getHiddenCollectionIDs = async (): Promise<number[]> =>
export const getCollectionUpdationTime = async (): Promise<number> =>
(await localForage.getItem<number>(COLLECTION_UPDATION_TIME)) ?? 0;
/**
* Pull the latest collections from remote.
*
* This function uses a delta diff, pulling only changes since the timestamp
* saved by the last pull.
*
* @returns The latest list of collections, reflecting both the state in our
* local database and on remote.
*/
export const pullCollections = async (): Promise<Collection[]> => {
const localCollections = await savedCollections();
let sinceTime = await getCollectionUpdationTime();

View File

@@ -116,7 +116,7 @@ export const deduceDuplicates = async () => {
nonHiddenOwnedCollections,
);
// Final all non-hidden collection files owned by the user that are in a
// Find all non-hidden collection files owned by the user that are in a
// non-hidden owned collection.
const nonHiddenCollectionFiles = await getLocalFiles("normal");
const filteredCollectionFiles = nonHiddenCollectionFiles.filter((f) =>

View File

@@ -73,8 +73,8 @@ export type RemoteTrashItem = z.infer<typeof RemoteTrashItem>;
* Update our locally saved data about the files and collections in trash by
* pulling changes from remote.
*
* This function uses a diff-based mechanism that pulls forward from the
* (persisted) latest pulled item's updated at time.
* This function uses a delta diff, pulling only changes since the timestamp
* saved by the last pull.
*
* @param collections All the (non-deleted) collections that we know about
* locally.