From 381a058eea1d1d053ed671bcdd82103ff3e3bee8 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Mon, 9 Dec 2024 12:47:13 -0330 Subject: [PATCH] Improve naming and usage of versionedData variable in background.js --- app/scripts/background.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 4b67a307e4f2..a8ef0bb8057f 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -127,7 +127,6 @@ let uiIsTriggering = false; const openMetamaskTabsIDs = {}; const requestAccountTabIds = {}; let controller; -let versionedData; const tabOriginMapping = {}; if (inTest || process.env.METAMASK_DEBUG) { @@ -615,12 +614,12 @@ export async function loadStateFromPersistence() { // read from disk // first from preferred, async API: - versionedData = await localStore.get(); + const preMigrationVersionedData = await localStore.get(); // report migration errors to sentry migrator.on('error', (err) => { // get vault structure without secrets - const vaultStructure = getObjStructure(versionedData); + const vaultStructure = getObjStructure(preMigrationVersionedData); sentry.captureException(err, { // "extra" key is required by Sentry extra: { vaultStructure }, @@ -628,7 +627,7 @@ export async function loadStateFromPersistence() { }); // migrate data - versionedData = await migrator.migrateData(versionedData); + const versionedData = await migrator.migrateData(preMigrationVersionedData); if (!versionedData) { throw new Error('MetaMask - migrator returned undefined'); } else if (!isObject(versionedData.meta)) {