treemapper
treemapper copied to clipboard
Species sync crash if using same account on two devices
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:
- Login on two devices and add a new species
- Store species on one device
- Store species on second device (e.g. by sync on logout)
- See error
Expected behavior Avoid error if API fails with above error.
What actually happens App got stuck on sync species screen.
Screenshots
Smartphone (please complete the following information):
- Device: iPhone simulator + Android emulator
- Tree Mapper App Version: 1.0.1