treemapper icon indicating copy to clipboard operation
treemapper copied to clipboard

Species sync crash if using same account on two devices

Open norbertschuler opened this issue 3 years ago • 1 comments

Describe the bug If a user is using the Treemapper app on two devices with the same account and having saved a species on one device and tries to store it on the other device with a species sync at logout as well, the app got stuck with an error as the API call POST https://app-development.plant-for-the-planet.org/treemapper/species to store the species fails with errror 400 as following:

Request POST https://app-development.plant-for-the-planet.org/treemapper/species

{
  "scientificSpecies": "sspec_G9J2HCzvnLkm97owCz",
  "aliases": "Arbutus xalapensis",
  "description": "Test\n",
  "imageFile": "data:image/jpeg;base64,...
}

Response:

{
  "code": 400,
  "message": "Validation Failed",
  "errors": {
    "errors": [
      "you already have defined a species based on the provided scientificSpecies id"
    ],
    "children": {
      "aliases": {},
      "imageFile": {},
      "description": {},
      "scientificSpecies": {}
    }
  }
}

Crash: TypeError: undefined is not an object (evaluating 'addFromAlreadySyncedSpecies(specie.guid, alreadySyncedSpecies).then')

Is it on a Production or Development Build? develop (maybe also production)

To Reproduce Steps to reproduce the behavior:

  1. Login on two devices and add a new species
  2. Store species on one device
  3. Store species on second device (e.g. by sync on logout)
  4. See error

Expected behavior Avoid error if API fails with above error.

What actually happens App got stuck on sync species screen.

Screenshots Screenshot_1622293646Screenshot_1622294149

Smartphone (please complete the following information):

  • Device: iPhone simulator + Android emulator
  • Tree Mapper App Version: 1.0.1

norbertschuler avatar May 29 '21 13:05 norbertschuler