Skip to content

prefer chainId over networkId in most cases#10594

Merged
brad-decker merged 3 commits intodevelopfrom
remove-get-network
Mar 12, 2021
Merged

prefer chainId over networkId in most cases#10594
brad-decker merged 3 commits intodevelopfrom
remove-get-network

Conversation

@brad-decker
Copy link
Copy Markdown
Contributor

@brad-decker brad-decker commented Mar 4, 2021

@darkwing
Copy link
Copy Markdown
Contributor

darkwing commented Mar 8, 2021

When we say "in most cases", what does that represent? We might want to document that.

@brad-decker
Copy link
Copy Markdown
Contributor Author

@darkwing https://github.com/MetaMask/metamask-extension/pull/10594/files#diff-ad1f68882a19fa4247caaa355b64dd6a6ae6c4e3c67b51c5a23e4727a0c91c01R86-R93

I added some inline documentation to the selector for networkId, but it might not be sufficient. I'll update the PR description to reflect this as well, but did you have some thoughts on where this documentation should live?

@brad-decker brad-decker force-pushed the remove-get-network branch 2 times, most recently from 8dc0e44 to 1d181b8 Compare March 9, 2021 22:56
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [1d181b8]
Page Load Metrics (642 ± 25 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46806094
domContentLoaded5657966415125
load5677976425125
domInteractive5657966415125

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [452e9f2]
Page Load Metrics (622 ± 15 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46685873
domContentLoaded5576886213115
load5596896223115
domInteractive5576876213115

@brad-decker brad-decker marked this pull request as ready for review March 10, 2021 18:00
@brad-decker brad-decker requested a review from a team as a code owner March 10, 2021 18:00
@brad-decker brad-decker requested a review from ryanml March 10, 2021 18:00
properties: {
action: 'Transactions',
errorMessage: txMeta.simulationFails?.reason,
numberOfTokens: metamaskState.tokens?.length ?? 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doesn't tokens default to a []? Is there a case where that property doesn't exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

background on this change: I saw that we had a 'getBackgroundMetaMetrics' selector in the UI folder that is only called from the background and I wanted to kill it with fire. I copied the intent of the selector 'getNumberOfTokens' from the frontend here which checks if tokens is specified.

action: 'Transactions',
errorMessage: txMeta.simulationFails?.reason,
numberOfTokens: metamaskState.tokens?.length ?? 0,
numberOfAccounts: Object.keys(metamaskState.accounts ?? {})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as above with accounts and {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above, but here I did add something that didn't exist before. I'll check into both of these and simplify the selectors if they can be.

@brad-decker
Copy link
Copy Markdown
Contributor Author

I added a commit that changes the name of getCurrentNetworkId to deprecatedGetCurrentNetworkId

image

between this and the @deprecated flag, I feel like there is a strong signal to not use this.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [7212382]
Page Load Metrics (587 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint43675584
domContentLoaded555616586199
load556616587199
domInteractive554615585199

@brad-decker brad-decker requested a review from ryanml March 12, 2021 15:14
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [0066733]
Page Load Metrics (626 ± 18 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47745884
domContentLoaded5627166243718
load5647176263818
domInteractive5627156243718

@brad-decker
Copy link
Copy Markdown
Contributor Author

@ryanml ready for another when you can.

@brad-decker brad-decker merged commit 3d4dfc7 into develop Mar 12, 2021
@brad-decker brad-decker deleted the remove-get-network branch March 12, 2021 22:23
@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat custom RPC networks with mainnet chainId as mainnet Prefer chainId over networkId whenever possible

5 participants