Skip to content

Commit

Permalink
Improve naming and usage of versionedData variable in background.js
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Dec 9, 2024
1 parent 646e41f commit 381a058
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ let uiIsTriggering = false;
const openMetamaskTabsIDs = {};
const requestAccountTabIds = {};
let controller;
let versionedData;
const tabOriginMapping = {};

if (inTest || process.env.METAMASK_DEBUG) {
Expand Down Expand Up @@ -615,20 +614,20 @@ 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 },
});
});

// 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)) {
Expand Down

0 comments on commit 381a058

Please sign in to comment.