runbox / runbox7

Runbox 7 web app
Other
127 stars 26 forks source link

#Mail: Deleted messages reappear momentarily with local index #1604

Open gtandersen opened 1 month ago

gtandersen commented 1 month ago

Describe the bug When deleting a (significant) number of messages while using the local index, they disappear momentarily and then reappear until the messages have been deleted on the server (?).

To Reproduce Steps to reproduce the behavior:

  1. Go to https://runbox.com/app and ensure the local index is in use
  2. Click to select a (large) number of messages
  3. Click to delete
  4. Observe that the messages disappear for then to reappear, and then finally disappear again

Expected behavior The messages should immediately disappear for good.

Desktop (please complete the following information):

gtandersen commented 1 month ago

See also #1555

castaway commented 1 month ago

This appears to be a timing issue: When running user changes (eg deleting messages), we ask the index worker to delete the data locally (from the browser copy of the index), which persists the changes to the indexdb, notifies the main thread to reload its copy of the index, which then redraws the list (so they disappear), while asking the api to delete the actual messages, which will eventually trigger an index update with the message removal from the backend.

This is while regular index updates are happening, so things may interleave rather than happen sequentially, so some of the messages (not always all of them!) reppear briefly, then disappear again.