Skip to content

feat: Convert AppStateController to typescript #27572

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

Merged
merged 37 commits into from
Oct 18, 2024

Conversation

kanthesha
Copy link
Contributor

@kanthesha kanthesha commented Oct 2, 2024

Description

As a prerequisite for migrating AppStateController to BaseController v2, and to support the TypeScript migration effort for the extension, we want to convert AppStateController to TypeScript along with its tests.

Open in GitHub Codespaces

Related issues

Fixes: #25922

Manual testing steps

N/A

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@kanthesha kanthesha requested a review from a team October 2, 2024 15:43
@kanthesha kanthesha self-assigned this Oct 2, 2024
Copy link
Contributor

github-actions bot commented Oct 2, 2024

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.

@metamaskbot
Copy link
Collaborator

Builds ready [23a89c3]
Page Load Metrics (1862 ± 100 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39723901790378181
domContentLoaded15692335183420096
load160423971862208100
domInteractive23164513316
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.41 KiB (0.04%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@kanthesha kanthesha added the DO-NOT-MERGE Pull requests that should not be merged label Oct 2, 2024
@kanthesha kanthesha marked this pull request as ready for review October 2, 2024 17:14
@kanthesha kanthesha requested review from kumavis and a team as code owners October 2, 2024 17:14
@kanthesha
Copy link
Contributor Author

This PR is blocked by PreferencesController upgrade to BaseControllerV2.

Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to remove app/script/app-state.d.ts now

@mikesposito
Copy link
Member

This PR is blocked by PreferencesController upgrade to BaseControllerV2.

Curious: why is this dependent on PreferencesController upgrade?

@kanthesha
Copy link
Contributor Author

This PR is blocked by PreferencesController upgrade to BaseControllerV2.

Curious: why is this dependent on PreferencesController upgrade?

It's not a complete blocker. But good to wait. AppStateController has a preferencesStore constructor param. In the mentioned PR, this has been updated with the preferencesState. So we don't have to worry about something which will be irrelevant once another PR merges.

@metamaskbot
Copy link
Collaborator

Builds ready [bfe0d3f]
Page Load Metrics (2035 ± 114 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32826841696695334
domContentLoaded177626782006235113
load178426842035238114
domInteractive14246706029
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.76 KiB (0.04%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@kanthesha kanthesha removed the DO-NOT-MERGE Pull requests that should not be merged label Oct 14, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [744300f]
Page Load Metrics (1893 ± 129 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32427871823435209
domContentLoaded162926931868257123
load165327961893268129
domInteractive158837209
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.75 KiB (0.04%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

cryptodev-2s
cryptodev-2s previously approved these changes Oct 16, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [dff8439]
Page Load Metrics (1905 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28225031828402193
domContentLoaded15882460186217885
load15952515190520297
domInteractive1997492110
backgroundConnect8213494421
firstReactRender47166813316
getState5113192713
initialActions01000
loadScripts10632027138018388
setupStore13108402713
uiStartup177529952129264127
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.91 KiB (0.05%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@@ -70,8 +69,6 @@ export default class MMIController extends EventEmitter {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public keyringController: any;

public preferencesController: PreferencesController;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change related to AppStateController?
I think that this PR joins the AppStateController typescript conversion, an initial migration to BaseControllerV2, and also some post-merge work derived from PreferencesController

If that's correct, perhaps splitting these changes in multiple specific PR would make it easier to go through all the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in mmi-controller were a small cleanup to remove the unused PreferencesController, which I can remove from this PR. And as you mentioned, there is also some preliminary work to prepare for the V2 upgrade. This prep work should help when we take-up the upgrade ticket.

That said, if it complicates the review, I’m happy to remove these changes from this PR and handle them separately. Let me know what works best!

cryptodev-2s
cryptodev-2s previously approved these changes Oct 17, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [a958732]
Page Load Metrics (1824 ± 73 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint26022421746376180
domContentLoaded15842232179615575
load16402244182415273
domInteractive16106412311
backgroundConnect884292211
firstReactRender491961024321
getState484192411
initialActions0482105
loadScripts11851840134915273
setupStore1273322411
uiStartup17882451207219996
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.91 KiB (0.05%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@@ -4,7 +4,6 @@
"app/scripts/constants/contracts.js",
"app/scripts/constants/on-ramp.js",
"app/scripts/contentscript.js",
"app/scripts/controllers/app-state.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@DDDDDanica DDDDDanica added this pull request to the merge queue Oct 18, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [2e86cfe]
Page Load Metrics (2091 ± 126 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint37029672017459220
domContentLoaded171029552063266128
load174729682091263126
domInteractive15102622813
backgroundConnect7103342813
firstReactRender492941165225
getState566252311
initialActions00000
loadScripts12772059154718489
setupStore116621157
uiStartup195631822349291140
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.91 KiB (0.04%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2024
@kanthesha kanthesha enabled auto-merge October 18, 2024 12:27
@kanthesha kanthesha added this pull request to the merge queue Oct 18, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [ebe4f3d]
Page Load Metrics (1752 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15712336175117785
domContentLoaded15152325172018287
load15712336175217785
domInteractive16108362110
backgroundConnect774312311
firstReactRender46288995728
getState45314168
initialActions01000
loadScripts10781813126215876
setupStore1096352914
uiStartup171525491974245118
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.91 KiB (0.04%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 18, 2024
@kanthesha kanthesha added this pull request to the merge queue Oct 18, 2024
Merged via the queue into develop with commit 36bde61 Oct 18, 2024
76 checks passed
@kanthesha kanthesha deleted the feat/app-state-controller-to-typescript branch October 18, 2024 13:48
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2024
@metamaskbot metamaskbot added the release-12.8.0 Issue or pull request that will be included in release 12.8.0 label Oct 18, 2024
@gauthierpetetin gauthierpetetin added release-12.6.0 Issue or pull request that will be included in release 12.6.0 and removed release-12.8.0 Issue or pull request that will be included in release 12.8.0 labels Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.6.0 Issue or pull request that will be included in release 12.6.0 team-wallet-framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Convert AppStateController (implementation + tests) to TypeScript
7 participants