Lost Data from iOS (related to sharing extension)

Just to update all of you on this issue: I have reproduced the problem, nailed down the exact cause of the issue, came up with a patch which fixes the issue and verified the fix to be working.

We will be pushing an update out soon!


For anyone interested in a technical overview of the bug:

Internally, dynalist uses a “diff” system to sync changes to the server. We store a local copy of your current Dynalist file, and a local copy of the “last synced” Dynalist file. When it’s time to send changes to the server, a “diff” is created by comparing these files and summarizing the difference.

When we compute the diff, an additional step of optimization is done to avoid scanning the whole file: we mark each item with a version number, and when they’re edited locally, the version number is bumped to indicate that it’s been changed. When computing a diff, any item with version numbers below the last synced number is ignored.

When you capture an item right after starting the app (i.e. when you share from another app), there’s a chance you click the button before the destination inbox document is loaded. We wait until it’s loaded before sending the item and showing a confirmation dialog.

The issue is caused by the fact that

  1. We insert the captured item when an event fires that the document is now available.
  2. The event is fired before the version number tags are loaded.
  3. This means the inserted item is tagged with a version number of 0, so the sync algorithm ignores it.

To fix the issue, I’ve made 2 changes. Either one of them should fix the issue, but I want to make things right:

  • When inserting the captured item, we wait until the full document loading cycle is over, rather than the moment when the document is available (event/signal).
  • When loading a document, its version tags are loaded first, before the document is made available.

The reason why it’s difficult to reproduce this issue is that most of the time, the document is already loaded. Or if your phone is fast enough, it might be loaded before you click on the capture button.

3 Likes