Skip to content

Commit a20c300

Browse files
committed
Refactor migration promise var name
1 parent 571dfcc commit a20c300

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/utils/migrateAuthKey.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { LocalStorage } from "@raycast/api";
33
const OLD_KEY = "app_key";
44
const NEW_KEY = "api_key";
55

6-
// Cache the migration promise to ensure it only runs once per session
7-
let migrationPromise: Promise<boolean> | null = null;
6+
let migrateAuthKeyPromise: Promise<boolean> | null = null;
87

98
/**
109
* Migrates authentication key from old localStorage key (app_key) to new key (api_key).
@@ -13,12 +12,12 @@ let migrationPromise: Promise<boolean> | null = null;
1312
* @returns {Promise<boolean>} True if migration was performed, false if not needed
1413
*/
1514
export async function migrateAuthKey(): Promise<boolean> {
16-
if (migrationPromise !== null) {
17-
return migrationPromise;
15+
if (migrateAuthKeyPromise !== null) {
16+
return migrateAuthKeyPromise;
1817
}
1918

20-
migrationPromise = performMigration();
21-
return migrationPromise;
19+
migrateAuthKeyPromise = performMigration();
20+
return migrateAuthKeyPromise;
2221
}
2322

2423
async function performMigration(): Promise<boolean> {

0 commit comments

Comments
 (0)