Skip to content
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

fix: Move foreground state properties from metamask slice to appState slice #28703

Conversation

MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Nov 25, 2024

Description

  1. Moves properties in the metamask Redux slice that are not part of background (i.e. controller-derived) state into the appState slice.

The affected state properties are as follows:

  customNonceValue: string;
  isAccountMenuOpen: boolean;
  isNetworkMenuOpen: boolean;
  nextNonce: string | null;
  pendingTokens: {
    [address: string]: Token & { isCustom?: boolean; unlisted?: boolean };
  };
  welcomeScreenSeen: boolean;
  confirmationExchangeRates: ContractExchangeRates;
  • Foreground properties that are a part of AppStateController state have not been moved into the appState slice, and will remain in the unflattened metamask slice.
    • It's not immediately clear why the properties listed above were excluded from AppStateController state, but since all of them appear to neither require persistence beyond a given session, nor anonymization of PII, I'm opting to maintain the status quo and keep them out of controller state.
  • The isInitialized property is not included, because it's derived from background state before the Redux store is instantiated, and is updated by the PatchStore which supplies it directly to the metamask slice.
  1. Groups appState slice selectors in ui/selectors/selectors.js together.

Open in GitHub Codespaces

Related issues

Manual testing steps

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.

Copy link
Contributor

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.

@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch 4 times, most recently from ae56b24 to 904d5b3 Compare November 26, 2024 10:42
@MajorLift MajorLift changed the title Clean up metamask Redux slice fix: Move foreground state properties from metamask slice to appState slice Nov 26, 2024
@MajorLift MajorLift added team-tiger Tiger team (for tech debt reduction + performance improvements) type-tech-debt Technical debt and removed team-wallet-framework labels Nov 26, 2024
@MajorLift MajorLift self-assigned this Nov 26, 2024
@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch from 904d5b3 to a0e1a64 Compare November 27, 2024 10:50
@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch 14 times, most recently from ffb2fea to 36eb3e6 Compare December 2, 2024 18:50
@MajorLift MajorLift marked this pull request as ready for review December 2, 2024 19:18
@MajorLift MajorLift requested review from a team as code owners December 2, 2024 19:18
@MajorLift MajorLift added this pull request to the merge queue Jan 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 10, 2025
@MajorLift MajorLift dismissed stale reviews from NidhiKJha, jpuri, and DDDDDanica via 9ce404a January 10, 2025 17:51
@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch from 9ce404a to 43c0789 Compare January 10, 2025 17:53
@MajorLift

This comment was marked as resolved.

@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch from 43c0789 to e4d66e9 Compare January 10, 2025 18:02
@metamaskbot

This comment was marked as resolved.

@MajorLift MajorLift enabled auto-merge January 10, 2025 18:26
@MajorLift

This comment was marked as resolved.

@metamaskbot

This comment was marked as resolved.

@MajorLift MajorLift force-pushed the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch from 3159830 to 859ae89 Compare January 10, 2025 18:46
@metamaskbot
Copy link
Collaborator

Builds ready [859ae89]
Page Load Metrics (1768 ± 77 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15482325177217383
domContentLoaded15192227173616077
load15492239176816177
domInteractive227035126
backgroundConnect1193372311
firstReactRender1677402412
getState66815168
initialActions00000
loadScripts11111743129214972
setupStore768212210
uiStartup17332604202019795
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: -130 Bytes (-0.00%)
  • common: -54 Bytes (-0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [835ffa3]
Page Load Metrics (1577 ± 44 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1488178115807737
domContentLoaded1436176115508642
load1475185215779144
domInteractive21137442914
backgroundConnect86524199
firstReactRender15101493617
getState478202210
initialActions01000
loadScripts1030131311517636
setupStore6529105
uiStartup164224711921236113
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: -130 Bytes (-0.00%)
  • common: -54 Bytes (-0.00%)

@EtherWizard33 EtherWizard33 self-requested a review January 13, 2025 15:10
Copy link

@EtherWizard33 EtherWizard33 left a comment

Choose a reason for hiding this comment

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

re-approving on behalf of @NidhiKJha

@MajorLift MajorLift added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit 2b377b3 Jan 13, 2025
79 checks passed
@MajorLift MajorLift deleted the jongsun/perf/redux/241122-move-metamask-slice-ui-properties-to-appstate-slice branch January 13, 2025 15:48
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2025
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Jan 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-extension-platform team-tiger Tiger team (for tech debt reduction + performance improvements) type-tech-debt Technical debt
Projects
Archived in project
8 participants