Update CollectibleContract data when it changes
-
CHANGED:
- Modifies the
addCollectibleContracton theCollectiblesControllerto updateCollectibleContractdata if there is a previous entry in state that matches the address of the contract currently being processed but other fields that don't match.
- Modifies the
@wachunei @mcmire & @gantunesr made a few more refactor changes in my latest commit: https://github.com/MetaMask/controllers/pull/680/commits/21847f8049686b1189a5dc9da36b3d69a31d2bdf
@wachunei @gantunesr @mcmire here's how I've been thinking we ought to determine whether to update the contract data:
If the new data contains data for all the keys as the old data (or more keys) but some of that data is different. If the old data contains some keys that the old doesn't we don't update.
Looking at the old code this wasn't the standard for updating - it was a basic equality check - but does it sound right to you? If not, what should the basis for updating be? Basic equality check? The problem I see with that is that we could overwrite more complete data with less complete data if there were some API issue. The reason I made this PR was because I saw some bad data come through the API at one point and then it was stuck because we never update it. Need some input on how best to proceed.
Asked for some input from product on this topic
It seems that we still need a product decision about how to handle updates and which data to keep. I'll move this into draft until we come to a conclusion on that
very stale