[Bug]: fetchWithCache Causing Storage Increases in Token Details
Describe the bug
The asset details page is using fetchWithCache to retrieve asset details from the following URL:
https://price.api.cx.metamask.io/v1/chains/${chainId}/historical-prices/${address}?vsCurrency=${currency}&timePeriod=${timePeriod}
This caches historical information by chain ID, contract address, and time range. The response is added to localStorage but never cleared, thus bloating the user's storage.
We should:
- Use native
fetchwith request caching to make these requests - Write a migration that clears out any
localStoragekeys that start withhttps://price.api.cx.metamask.io/v1/chains/
Expected behavior
Nothing added to localStorage
Screenshots/Recordings
No response
Steps to reproduce
- Go to any asset details page
- See storage grow
Error messages or log output
Detection stage
In production (default)
Version
12.18.2
Build type
None
Browser
Chrome
Operating system
MacOS
Hardware wallet
No response
Additional context
No response
Severity
No response
I am checking this one during the Quality Sprint. It doesn't look like this was addressed in the Epic ticket linked, so I am leaving it open for the team to look over.