-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: hide testnet amounts if user opt out in the settings #25167
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: hide testnet amounts if user opt out in the settings #25167
Conversation
Builds ready [cefe856]
Page Load Metrics (272 ± 287 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #25167 +/- ##
===========================================
+ Coverage 64.88% 64.89% +0.01%
===========================================
Files 1388 1389 +1
Lines 55091 55103 +12
Branches 14471 14475 +4
===========================================
+ Hits 35743 35754 +11
- Misses 19348 19349 +1 ☔ View full report in Codecov by Sentry. |
ui/pages/confirmations/components/simulation-details/fiat-display.tsx
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx
Outdated
Show resolved
Hide resolved
const mockStateWithTestnet = merge({}, mockState, { | ||
metamask: { | ||
providerConfig: { | ||
chainId: CHAIN_IDS.SEPOLIA, |
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.
If we are going with this approach, I believe it's crucial to set some state props like this for the branch of these tests.
Even if mockState
is set as using Goerli chain id which is fine for this test, I believe we should still set the stage for only our test. This is the reason of I am creating mockStateWithTestnet
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.
I think extending the default state in the unit tests is a standard pattern.
We also could have defined a CHAIN_ID_MOCK
constant using the mockState
but this is great also.
…ets-if-its-opted-out-by-user
…ets-if-its-opted-out-by-user
Builds ready [588c8d1]
Page Load Metrics (55 ± 6 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
ui/hooks/useHideFiatForTestnet.ts
Outdated
*/ | ||
export const useHideFiatForTestnet = (providedChainId?: Hex): boolean => { | ||
const showFiatInTestnets = useSelector(getShowFiatInTestnets); | ||
const chainId = providedChainId ?? useSelector(getCurrentChainId); |
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.
We always have to call useSelector
even if we don't use the value, since it's a hook.
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.
Done
const mockStateWithTestnet = merge({}, mockState, { | ||
metamask: { | ||
providerConfig: { | ||
chainId: CHAIN_IDS.SEPOLIA, |
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.
I think extending the default state in the unit tests is a standard pattern.
We also could have defined a CHAIN_ID_MOCK
constant using the mockState
but this is great also.
…ets-if-its-opted-out-by-user
Builds ready [9852b71]
Page Load Metrics (133 ± 165 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR aims to hide testnet fiat values if user opt out in the settings.
Related issues
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist