AccountStorage: Fix migration logic

This commit is contained in:
Cohee
2025-02-12 12:00:31 +02:00
parent 43f524bb5f
commit 829888bda7

View File

@@ -49,11 +49,13 @@ class AccountStorage {
#ready = false;
#migrateLocalStorage() {
const localStorageKeys = [];
for (let i = 0; i < globalThis.localStorage.length; i++) {
const key = globalThis.localStorage.key(i);
const value = globalThis.localStorage.getItem(key);
localStorageKeys.push(globalThis.localStorage.key(i));
}
for (const key of localStorageKeys) {
if (MIGRATABLE_KEYS.some(k => k.test(key))) {
const value = globalThis.localStorage.getItem(key);
this.#state[key] = value;
globalThis.localStorage.removeItem(key);
}