core icon indicating copy to clipboard operation
core copied to clipboard

Update CollectibleContract data when it changes

Open adonesky1 opened this issue 3 years ago • 4 comments

  • CHANGED:

    • Modifies the addCollectibleContract on the CollectiblesController to update CollectibleContract data 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.

adonesky1 avatar Jan 25 '22 18:01 adonesky1

@wachunei @mcmire & @gantunesr made a few more refactor changes in my latest commit: https://github.com/MetaMask/controllers/pull/680/commits/21847f8049686b1189a5dc9da36b3d69a31d2bdf

adonesky1 avatar Jan 26 '22 22:01 adonesky1

@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.

adonesky1 avatar Jan 27 '22 16:01 adonesky1

Asked for some input from product on this topic

adonesky1 avatar Jan 28 '22 22:01 adonesky1

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

Gudahtt avatar Mar 23 '22 19:03 Gudahtt

very stale

adonesky1 avatar Sep 26 '23 16:09 adonesky1