Closed dstillman closed 5 months ago
Couldn't recreate such a scenario so far. During sharing, sync happens always before advancing any versions. We can ask the users to describe how they use the share extension, to understand if there is an edge case we haven't covered,
And that's the case even if the app is force-quit?
Did you try with 1.0.24?
Oh, wait, 1.0.24 is from November, not February. Maybe this is an old bug that we fixed, and these people were using outdated versions?
And that's the case even if the app is force-quit?
It shouldn't matter, as the share extension itself will sync any changes in the local database.
Well, it looks like the share extension just uploads new items without passing If-Unmodified-Since-Version (so presumably with version: 0
for each object), so it doesn't need to download items at all and can let the app do that later.
But I figured it out. It's the file upload request. When there's a file, the version number gets advanced and the app misses remote updates.
Along with fixing this, we'd ideally trigger a "full sync" on upgrade — i.e., a sync that checks the versions of all objects in the online library and compares to the local versions, and then downloads updates. (It would also look for local changes that were missing remotely, but that wouldn't matter here.) I can't remember if we ever implemented code to do that on iOS.
I found out why my first tests didn't produce the error. I saved a science direct article, which always resulted to the "ExtensionViewModel: upload authorized" case, that doesn't cause the issue.
When I saved the article you suggested @dstillman, it followed the alternate case "ExtensionViewModel: file exists remotely", that indeed saves the items version, overlooking the unfetched changes. Removing that, resolves this issue.
We previously ran a full sync on startup — seemingly to fix an extremely similar bug — but it looks like that was done as a one-off. If that's still what's in place, we should instead use a counter there that we can increment when this needs to be done, and then have it run now for upgraders.
Closed by #884 & #885
This looks a lot like the share extension is advancing the library version without actually downloading objects.