cowprotocol / cowswap

🐮 CowSwap: First CoW Protocol UI
https://swap.cow.fi/
GNU General Public License v3.0
116 stars 87 forks source link

[Explorer] Refactor token storage/load #4002

Open alfetopito opened 6 months ago

alfetopito commented 6 months ago

Summary

I have the strong impression something broken along the way (or was never right?) and the global state:

  1. Does not properly cache tokens from one page to the next
  2. Does not de-dupe queries for repeated tokens

We should probably re-write https://github.com/cowprotocol/cowswap/blob/develop/apps/explorer/src/state/erc20/hooks.ts and remove redux in favor of Jotai, fixing the aforementioned issues.

Should be less relevant once we load tokens from token lists (#4000), but still, we should be capable of loading and storing network tokens locally.

Should also store network loaded tokens on localStorage to reduce even further the need to reach the network for already seen tokens.

Context

Related to #4000

alfetopito commented 5 months ago

Partially addressed on https://github.com/cowprotocol/cowswap/pull/4245 Not a full re-work, but replaced redux with jotai and now storing tokens on localStorage