-
Notifications
You must be signed in to change notification settings - Fork 5k
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: change CurrencyRateController Polling to be UI driven #23476
refactor: change CurrencyRateController Polling to be UI driven #23476
Conversation
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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #23476 +/- ##
===========================================
- Coverage 67.53% 67.46% -0.06%
===========================================
Files 1261 1263 +2
Lines 49289 49327 +38
Branches 12856 12854 -2
===========================================
- Hits 33283 33278 -5
- Misses 16006 16049 +43 ☔ View full report in Codecov by Sentry. |
Builds ready [0c8eefb]
Page Load Metrics (1029 ± 420 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
…g-hook-global' into jl/mmp-2083/currency-rate-polling-hook-global
Builds ready [ad1c711]
Page Load Metrics (1272 ± 574 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
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!
Builds ready [23b4931]
Page Load Metrics (1136 ± 627 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Is this actually desired? By making the HTTP request timing depend on user action, user activity metadata leaking to price provider (and middle-parties) will increase. Tangential but related: Why are we not fetching currency rates like ETH-USD via on-chain oracles instead (or in addition)? This would enable price lookups without any third-party connections, only relying on |
not sure I follow? Are you saying that the metadata associated with http requests of when users have certain UI's open is a leak? If so I don't think thats really a reasonable boundary to set out for ourself, it a pretty common pattern for how to determine when or when not to make queries... but perhaps I'm misunderstanding. The goal here is to only query for what we need based on what actual data needs to be rendered and minimize any additional polling we're doing outside of that.
Definitely worth considering but very much out of scope for this particular PR. I would raise this with @alfeng6 and the assets team! |
Builds ready [17af907]
Page Load Metrics (1789 ± 664 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
Currently currency rate polling is started and stopped based on active trusted connections to the
MetaMaskController
(i.e. whenever the wallet ui is opened). In the future we want polling to be tied to the actual components that rely on polled currency rate state. As a transitionary step, this PR moves currency rate polling fromMetaMaskController
into a hook that wraps the root level<Routes>
component. Nothing changes except that currency rate polling goes from being MetaMaskController connection driven to actually wallet UI driven. Polling will still occur as long at least one wallet UI is open as it currently already does.Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2083
Manual testing steps
min-api.cryptocompare.com
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist