inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
63 stars 21 forks source link

Deleted observations should not be counted when uploading #1631

Closed abhasinat closed 2 months ago

abhasinat commented 3 months ago

Describe the bug Right now, if you delete a saved observation, the "upload X observations" still includes the observation in its count

To Reproduce Steps to reproduce the behavior:

  1. Make 2 observations while logged in and save both to the device
  2. Go to my obs and see "Upload 2 observations"
  3. Open obs edit for one of the two saved obs and delete it
  4. Return to My obs and still see "upload 2 observations"

Expected behavior When a saved observation is deleted, it should not be included in the upload count. in the example above, the number should immediately change to "Upload 1 observation"

Context (please complete the following information):

abhasinat commented 3 months ago

Repro steps continued:

  1. Turn your phone into airplane mode
  2. make and save 2 observations
  3. delete both of them
  4. turn off airplane mode
  5. Click the sync button and see "uploading 4 observations"
kueda commented 3 months ago

This is not quite fixed using Abhas's second set of steps. Here's a modified repro case:

  1. Sign in to an account with observations
  2. Enter airplane mode
  3. Add two observations w/o evidence; note toolbar says "Upload 2 observations"
  4. Delete both observations
  5. Toolbar still says "Upload 2 observations"

So that's the first problem. Then:

  1. Force quit the app
  2. Exist airplane mode and make sure you're online
  3. Open the app
  4. Toolbar immediately does something and then there's a success status that says "2 observations deleted"
  5. After the timeout the toolbar resets, but now it says "Upload 1 observation"

And that's the second problem. Here's a related third problem

  1. Sign out, force quit, and re-open
  2. Make 1 observation without evidence and save
  3. Delete that observation
  4. The header still says "Log in to contribute & sync 1 observation"

There doesn't seem to be anything you can do to get rid of that state other that signing in or reinstalling the app. Even force quitting doesn't clear it.

albullington commented 3 months ago

@kueda for the logged out state I made a separate issue, because right now we're preventing logged out users from being able to delete local observations at all: https://github.com/inaturalist/iNaturalistReactNative/issues/1654