Use consistent key

This commit is contained in:
Manav Rathi
2024-07-11 14:39:45 +05:30
parent fdcc6b6997
commit 544a5a9ccc
6 changed files with 21 additions and 13 deletions

View File

@@ -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) => {

View File

@@ -58,7 +58,7 @@ export const pendingUploads = async (): Promise<PendingUploads | undefined> => {
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

View File

@@ -33,8 +33,10 @@ const App: React.FC<AppProps> = ({ 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);

View File

@@ -71,8 +71,11 @@ const Contents: React.FC<ContentsProps> = (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<FormProps> = ({ 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;
}

View File

@@ -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"),

View File

@@ -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