π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Await not trigger
Manav Rathi69a5795c86a9
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex b1703b6728..aab41ce0df 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -105,7 +105,7 @@ import {getSectionSummaries,} from "services/collectionService";import { syncFiles } from "services/fileService";-import { sync, triggerPreFileInfoSync } from "services/sync";+import { preFileInfoSync, sync } from "services/sync";import { syncTrash } from "services/trashService";import uploadManager from "services/upload/uploadManager";import { isTokenValid } from "services/userService";@@ -720,7 +720,7 @@ export default function Gallery() {throw new Error(CustomError.SESSION_EXPIRED);}!silent && startLoading();- triggerPreFileInfoSync();+ await preFileInfoSync();const collections = await getAllLatestCollections();const { normalCollections, hiddenCollections } =await splitNormalAndHiddenCollections(collections);diff --git a/web/apps/photos/src/services/sync.ts b/web/apps/photos/src/services/sync.tsindex 0f1e3ded1b..eff5b4d6d1 100644--- a/web/apps/photos/src/services/sync.ts+++ b/web/apps/photos/src/services/sync.ts@@ -1,7 +1,7 @@-import { fetchAndSaveFeatureFlagsIfNeeded } from "@/new/photos/services/feature-flags";+import { triggerFeatureFlagsFetchIfNeeded } from "@/new/photos/services/feature-flags";import {isMLSupported,- triggerMLStatusSync,+ mlStatusSync,triggerMLSync,wipClusterEnable,} from "@/new/photos/services/ml";@@ -15,9 +15,9 @@ import { syncMapEnabled } from "services/userService";/*** Part 1 of {@link sync}. See TODO below for why this is split.*/-export const triggerPreFileInfoSync = () => {- fetchAndSaveFeatureFlagsIfNeeded();- if (isMLSupported) triggerMLStatusSync();+export const preFileInfoSync = async () => {+ triggerFeatureFlagsFetchIfNeeded();+ await Promise.all([isMLSupported && mlStatusSync()]);};/**diff --git a/web/packages/new/photos/services/feature-flags.ts b/web/packages/new/photos/services/feature-flags.tsindex 1f2e4329bc..d694522228 100644--- a/web/packages/new/photos/services/feature-flags.ts+++ b/web/packages/new/photos/services/feature-flags.ts@@ -34,7 +34,7 @@ let _haveFetched = false;* the default. Otherwise the now fetched result is saved to local storage* and the corresponding value returned.*/-export const fetchAndSaveFeatureFlagsIfNeeded = () => {+export const triggerFeatureFlagsFetchIfNeeded = () => {if (_haveFetched) return;if (_fetchTimeout) return;// Not critical, so fetch these after some delay.diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.tsindex a57bb2c03f..65c7bb88fc 100644--- a/web/packages/new/photos/services/ml/index.ts+++ b/web/packages/new/photos/services/ml/index.ts@@ -279,14 +279,12 @@ const updateIsMLEnabledRemote = (enabled: boolean) =>* It checks with remote if the ML flag is set, and updates our local flag to* reflect that value.*- * To trigger the actual ML sync, use {@link triggerMLSync}.+ * To perform the actual ML sync, use {@link mlSync}.*/-export const triggerMLStatusSync = () => void mlStatusSync();--const mlStatusSync = async () => {+export const mlStatusSync = async () => {_state.isMLEnabled = await getIsMLEnabledRemote();setIsMLEnabledLocal(_state.isMLEnabled);- triggerStatusUpdate();+ return updateMLStatusSnapshot();};/**@@ -298,7 +296,7 @@ const mlStatusSync = async () => {* If ML is enabled, it pulls any missing embeddings from remote and starts* indexing to backfill any missing values.*- * This will only have an effect if {@link triggerMLSync} has been called at+ * This will only have an effect if {@link mlStatusSync} has been called at* least once prior to calling this in the sync sequence.*/export const triggerMLSync = () => void mlSync();