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] Slow cold starts, fix unnecessary executions of useEffect #5444

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

Fatxx
Copy link
Contributor

@Fatxx Fatxx commented Jan 2, 2023

Development & PR Process

  1. Follow MetaMask Mobile Coding Standards
  2. Add release-xx label to identify the PR slated for a upcoming release (will be used in release discussion)
  3. Add needs-dev-review label when work is completed
  4. Add needs-qa label when dev review is completed
  5. Add QA Passed label when QA has signed off

Description
This PR fixes slow cold start.
There is still a place for improvement since we have a lot of asynchronous functions running when bootstrapping the application, from my discoverings Analytics init and any reads from Async Storage tend to be slow but that's something that we explicitly need for the app to work.

Removed unnecessary use of await.

1. What is the reason for the change?
useEffect is executing multiple times causing unnecessary reads from Async Storage.
2. What is the improvement/solution?
Force only one execution (onMount)

Screenshots/Recordings
Before: https://recordit.co/X1VFwVcQrh
After: https://recordit.co/R4OdM5QTM2

Issue

Progresses #5382

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

@Fatxx Fatxx requested a review from a team as a code owner January 2, 2023 18:27
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2023

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.

@Fatxx Fatxx added Code Impact - Low Minor code change that can safely applied to the codebase needs-qa Any New Features that needs a full manual QA prior to being added to a release. needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jan 2, 2023
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Nice improvement. LGTM

@Fatxx Fatxx added release-5.14.0 Issue or pull request that will be included in release 5.14.0 Mobile QA board and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jan 10, 2023
@sethkfman sethkfman added the Priority - High Task with high priority label Jan 10, 2023
@chrisleewilcox chrisleewilcox self-assigned this Jan 17, 2023
@chrisleewilcox chrisleewilcox added QA in Progress QA has started on the feature. QA Passed A successful QA run through has been done and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. QA in Progress QA has started on the feature. labels Jan 17, 2023
@chrisleewilcox chrisleewilcox merged commit e79ba64 into main Jan 18, 2023
@chrisleewilcox chrisleewilcox deleted the fix/slow-cold-start branch January 18, 2023 00:34
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2023
@sethkfman sethkfman added release-5.14.0 Issue or pull request that will be included in release 5.14.0 and removed release-5.14.0 Issue or pull request that will be included in release 5.14.0 labels Jan 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Code Impact - Low Minor code change that can safely applied to the codebase Priority - High Task with high priority QA Passed A successful QA run through has been done release-5.14.0 Issue or pull request that will be included in release 5.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants