Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrations not being applied on 7.14.0 (#8271)
## **Description** This pull request addresses an issue we were facing with migrations not being applied. The root cause was a change in how Babel v6 and v7 compiles ES6 `export default` to CommonJS, which differs from its previous behavior in Babel v5. source: https://stackoverflow.com/questions/33704714/cant-require-default-export-value-in-babel-6-x Previously, we were using `require` to load the migration files. However, due to the change in Babel's compilation, we would need to append `.default` to each migration when using `require`, as Babel now compiles `export default` to `exports.default`. To maintain consistency with the current pattern in our app and to avoid appending `.default` to each migration, I have switched from using `require` to `import`. This change aligns with our usage of ES6 syntax throughout the application and ensures that migrations are correctly applied. ## **Related issues** Fixes: ## **Manual testing steps** -> Install 7.12.5 -> Import an account via SRP -> Install 7.14.0 -> Vault recovery shouldn't happen ## **Screenshots/Recordings** This recording shows 7.14.0 after being updated from 7.12.5 IOS: https://github.com/MetaMask/metamask-mobile/assets/46944231/a7618468-c816-4b3c-a900-19ab3c2c2d5a Android: https://github.com/MetaMask/metamask-mobile/assets/46944231/c97a03eb-153f-4bc3-9103-b2712f99e41f ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: sethkfman <seth.kaufman@consensys.net>
- Loading branch information