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

refactor(tokens): update networksIconSelector to return all icons #5147

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

satish-ravi
Copy link
Contributor

@satish-ravi satish-ravi commented Mar 25, 2024

Description

Accepting network ids as an array would mean that the selector recomputes the result even if the same list of network ids are passed and returns a new result, resulting in unnecessary rerenders. This updates it so that the selector returns all network id's icons. An alternative approach would be to set memoizeOptions like tokenIdsSelector, but there doesn't seem to be any harm in returning all network's icon in the function. The consumer of this selector can pick the required networks' icon from the object

Test plan

CI, ensured the below warning doesn't show in #5148 when merged with this change

Related issues

N/A

Backwards compatibility

Yes

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.70%. Comparing base (98637c3) to head (f4705eb).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5147   +/-   ##
=======================================
  Coverage   85.70%   85.70%           
=======================================
  Files         730      730           
  Lines       29862    29861    -1     
  Branches     5156     5156           
=======================================
+ Hits        25592    25593    +1     
+ Misses       4035     4033    -2     
  Partials      235      235           
Files Coverage Δ
src/tokens/TokenImport.tsx 93.50% <100.00%> (ø)
src/tokens/saga.ts 75.80% <100.00%> (ø)
src/tokens/selectors.ts 96.21% <100.00%> (-0.02%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98637c3...f4705eb. Read the comment docs.

Copy link
Collaborator

@kathaypacific kathaypacific left a comment

Choose a reason for hiding this comment

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

@satish-ravi satish-ravi added this pull request to the merge queue Mar 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 25, 2024
@satish-ravi satish-ravi added this pull request to the merge queue Mar 25, 2024
Merged via the queue into main with commit 8de58fa Mar 25, 2024
18 checks passed
@satish-ravi satish-ravi deleted the satish/fix-network-icon-selector branch March 25, 2024 17:49
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
…lora-inc#5147)

### Description

Accepting network ids as an array would mean that the selector
recomputes the result even if the same list of network ids are passed
and returns a new result, resulting in unnecessary rerenders. This
updates it so that the selector returns all network id's icons. An
alternative approach would be to set `memoizeOptions` like
`tokenIdsSelector`, but there doesn't seem to be any harm in returning
all network's icon in the function. The consumer of this selector can
pick the required networks' icon from the object

### Test plan

CI, ensured the below warning doesn't show in valora-inc#5148 when merged with
this change
<img
src="https://github.com/valora-inc/wallet/assets/5062591/14ac3745-d92c-44a7-9a1a-4c93837eff2e"
width="200"/>


### Related issues

N/A

### Backwards compatibility

Yes

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- [x] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants