-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Simplify Engine constructor #7091
Conversation
For reviewers, I'd strongly recommend using the "Hide whitespace" option in the diff view. Most of the changes are due to the constructor indentation change. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7091 +/- ##
==========================================
- Coverage 32.83% 32.82% -0.01%
==========================================
Files 1001 1001
Lines 26709 26706 -3
Branches 2096 2095 -1
==========================================
- Hits 8769 8766 -3
Misses 17524 17524
Partials 416 416
☔ View full report in Codecov by Sentry. |
The Engine class is riddled with type errors, which has been making the controller updates difficult. In attempting to address these errors, one of the first obstacles was the conditional constructor. The types for the class would be a lot simpler if we could assume that certain properties were always initialized, but the condition prevents that. The condition was meant to ensure that only one global Engine instance was ever constructed. This check has been moved to the `init` function at the end of the file instead. This has the same effect, as that function is the only place the Engine class is constructed (it's not exported). This is much easier for TypeScript to understand. This relates to MetaMask/mobile-planning#1015
bfa2b63
to
cd35edf
Compare
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs 91.7% Coverage The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Development & PR Process
release-xx
label to identify the PR slated for a upcoming release (will be used in release discussion)needs-dev-review
label when work is completedneeds-qa
: PR requires manual QA.No QA/E2E only
: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.Spot check on release build
: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.QA Passed
label when QA has signed off (Only required if the PR was labeled withneeds-qa
)team-
(orexternal-contributor
label if your not a MetaMask employee)Description
The Engine class is riddled with type errors, which has been making the controller updates difficult. In attempting to address these errors, one of the first obstacles was the conditional constructor. The types for the class would be a lot simpler if we could assume that certain properties were always initialized, but the condition prevents that.
The condition was meant to ensure that only one global Engine instance was ever constructed. This check has been moved to the
init
function at the end of the file instead. This has the same effect, as that function is the only place the Engine class is constructed (it's not exported). This is much easier for TypeScript to understand.Issue
This relates to https://github.com/MetaMask/mobile-planning/issues/1015
Checklist