From 544a5a9ccc908b9e7c6ddc43ec042c12617e1cb3 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 11 Jul 2024 14:39:45 +0530 Subject: [PATCH] Use consistent key --- desktop/src/main.ts | 2 +- desktop/src/main/services/upload.ts | 2 +- web/apps/accounts/src/pages/_app.tsx | 6 ++++-- web/packages/new/photos/components/DevSettings.tsx | 14 ++++++++++---- web/packages/new/photos/services/ml/db.ts | 8 ++++---- web/packages/next/i18n.ts | 2 +- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/desktop/src/main.ts b/desktop/src/main.ts index be5721ed0e..2622d09a6e 100644 --- a/desktop/src/main.ts +++ b/desktop/src/main.ts @@ -537,7 +537,7 @@ const setupTrayItem = (mainWindow: BrowserWindow) => { * old cache dir if it exists. * * Added May 2024, v1.7.0. This migration code can be removed after some time - * once most people have upgraded to newer versions. + * once most people have upgraded to newer versions (tag: Migration). */ const deleteLegacyDiskCacheDirIfExists = async () => { const removeIfExists = async (dirPath: string) => { diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.ts index 3da9cafd7c..a7e3fc8671 100644 --- a/desktop/src/main/services/upload.ts +++ b/desktop/src/main/services/upload.ts @@ -58,7 +58,7 @@ export const pendingUploads = async (): Promise => { const allZipItems = uploadStatusStore.get("zipItems"); let zipItems: typeof allZipItems; - // Migration code - May 2024. Remove after a bit. + // Migration code - May 2024. Remove after a bit (tag: Migration). // // The older store formats will not have zipItems and instead will have // zipPaths. If we find such a case, read the zipPaths and enqueue all of diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx index 7029cacd86..2cf427b918 100644 --- a/web/apps/accounts/src/pages/_app.tsx +++ b/web/apps/accounts/src/pages/_app.tsx @@ -33,8 +33,10 @@ const App: React.FC = ({ Component, pageProps }) => { useEffect(() => { disableDiskLogs(); // The accounts app has no local state, but some older builds might've - // leftover some scraps. Clear it out. This code added 1 July 2024, can - // be removed after a while (tag: Migration). + // leftover some scraps. Clear it out. + // + // This code added on 1 July 2024, can be removed soon since this data + // was never saved before this was released (tag: Migration). clearData(); void setupI18n().finally(() => setIsI18nReady(true)); logUnhandledErrorsAndRejections(true); diff --git a/web/packages/new/photos/components/DevSettings.tsx b/web/packages/new/photos/components/DevSettings.tsx index 84c71b09c5..7919314068 100644 --- a/web/packages/new/photos/components/DevSettings.tsx +++ b/web/packages/new/photos/components/DevSettings.tsx @@ -71,8 +71,11 @@ const Contents: React.FC = (props) => { () => void getKV("apiOrigin").then((o) => setInitialAPIOrigin( - // TODO: Migration of apiOrigin from local storage to indexed DB - // Remove me after a bit (27 June 2024). + // Migrate apiOrigin from local storage to indexed DB. + // + // This code was added 27 June 2024. Note that the legacy + // value was never in production builds, only nightlies, so + // this code can be removed soon (tag: Migration). o ?? localStorage.getItem("apiOrigin") ?? "", ), ), @@ -215,8 +218,11 @@ const Form: React.FC = ({ initialAPIOrigin, onClose }) => { const updateAPIOrigin = async (origin: string) => { if (!origin) { await removeKV("apiOrigin"); - // TODO: Migration of apiOrigin from local storage to indexed DB - // Remove me after a bit (27 June 2024). + // Migrate apiOrigin from local storage to indexed DB. + // + // This code was added 27 June 2024. Note that the legacy value was + // never in production builds, only nightlies, so this code can be + // removed at some point soon (tag: Migration). localStorage.removeItem("apiOrigin"); return; } diff --git a/web/packages/new/photos/services/ml/db.ts b/web/packages/new/photos/services/ml/db.ts index 9e4f9cf90b..51ca2f749b 100644 --- a/web/packages/new/photos/services/ml/db.ts +++ b/web/packages/new/photos/services/ml/db.ts @@ -135,14 +135,14 @@ const openMLDB = async () => { const deleteLegacyDB = () => { // Delete the legacy face DB v1. // - // This code was added June 2024 (v1.7.1-rc) and can be removed once clients - // have migrated over. + // This code was added June 2024 (v1.7.1-rc) and can be removed at some + // point when most clients have migrated (tag: Migration). void deleteDB("mldata"); // Delete the legacy CLIP (mostly) related keys from LocalForage. // - // This code was added July 2024 (v1.7.2-rc) and can be removed once - // sufficient clients have migrated over (tag: Migration). + // This code was added July 2024 (v1.7.2-rc) and can be removed at some + // point when most clients have migrated (tag: Migration). void Promise.all([ localForage.removeItem("embeddings"), localForage.removeItem("embedding_sync_time"), diff --git a/web/packages/next/i18n.ts b/web/packages/next/i18n.ts index cec28add94..9cd5293832 100644 --- a/web/packages/next/i18n.ts +++ b/web/packages/next/i18n.ts @@ -136,7 +136,7 @@ const savedLocaleStringMigratingIfNeeded = (): SupportedLocale | undefined => { // This migration is dated Feb 2024. And it can be removed after a few // months, because by then either customers would've opened the app and // their setting migrated to the new format, or the browser would've cleared - // the older local storage entry anyway. + // the older local storage entry anyway (tag: Migration). if (!ls) { // Nothing found