education-cryptomoji icon indicating copy to clipboard operation
education-cryptomoji copied to clipboard

Client: Refactor solution code

Open therobinkim opened this issue 6 years ago • 0 comments

(I might break up this issue into multiple issues.)

Just throwing some ideas out there to better manage state and reduce the complexity involved with making multiple API calls from the different components (which also slows down the performance of the app).

  • Store user's collection in one place (can be reused when viewing own collection or with <BreedDropDownMenu/>)
  • Store user's public key and private key via Context API

And

  • Just render parseDna as soon as it's available instead of worrying about whether its sire indicator should appear or not yet (also don't worrying about bad dna; parsing DNA will always work!)
  • If fetching information for a whole collection, also fetch details about the moji in the collection (but only fetch details about the collection's sire once?)
  • If fetching information for a list of sires, you already have details about the moji in the random list (so don't fetch details about each moji's collection's sire)
  • If fetching information for a list of random moji, also fetch details about the moji in the random list (and also fetch details about each moji's collection's sire)

Alternatively,

  1. Don't fetch information about sires until all moji info has been fetched
  2. Determine the collections that the moji belong to
  3. Only fetch sire details for those collections
  4. Go through entire list of moji and set their isSire prop to true (maybe show a "pending" icon in the meantime)

Alternatively,

  • Just don't render the sire indicator when a list of moji are being displayed

therobinkim avatar Jul 03 '18 20:07 therobinkim