diff --git a/web/apps/photos/src/pages/gallery/index.tsx b/web/apps/photos/src/pages/gallery/index.tsx index d375e48fc8..65857d5f0a 100644 --- a/web/apps/photos/src/pages/gallery/index.tsx +++ b/web/apps/photos/src/pages/gallery/index.tsx @@ -87,6 +87,7 @@ import { import downloadManager from "services/download"; import { syncCLIPEmbeddings } from "services/embeddingService"; import { syncEntities } from "services/entityService"; +import { fetchAndSaveFeatureFlags } from "services/feature-flag"; import { getLocalFiles, syncFiles } from "services/fileService"; import locationSearchService from "services/locationSearchService"; import { getLocalTrashedFiles, syncTrash } from "services/trashService"; @@ -340,6 +341,7 @@ export default function Gallery() { return; } preloadImage("/images/subscription-card-background"); + let ffTimeout: ReturnType | undefined; const electron = globalThis.electron; const main = async () => { const valid = await validateKey(); @@ -383,6 +385,11 @@ export default function Gallery() { syncInterval.current = setInterval(() => { syncWithRemote(false, true); }, SYNC_INTERVAL_IN_MICROSECONDS); + // Not critical, so fetch these after some delay. + ffTimeout = setTimeout(() => { + ffTimeout = undefined; + void fetchAndSaveFeatureFlags(); + }, 5000); if (electron) { // void clipService.setupOnFileUploadListener(); electron.onMainWindowFocus(() => syncWithRemote(false, true)); @@ -391,6 +398,7 @@ export default function Gallery() { main(); return () => { clearInterval(syncInterval.current); + if (ffTimeout) clearTimeout(ffTimeout); if (electron) { electron.onMainWindowFocus(undefined); clipService.removeOnFileUploadListener();