How to know if a cached doc has already been sync'ed or not?

My coins app is offline-first (WIP). I need to be able to show to my users which new entries are not yet sync’ed. E.g.:

  1. User is online and sync’s everything.
  2. User goes offline.
  3. User adds new entry.
  4. App shows entry “grayed out”.
  5. User goes online.
  6. App syncs entry and shows it as sync’ed – just like all the others.

How would I go about implementing this?

In the API Docs there’s a WireClient “change” event, but it is stated: Never fired for some reason # TODO create issue and fix or remove.

I don’t believe there’s an easy way to do it nowadays, so I ask you: If I were about to implement this in rs.js itself, how (where) do you suggest doing it?

Thank you.

Maybe it would make sense to pass a callback function for synced changes to the store/remove methods of the BaseClient. Not sure. Anyone else has any ideas?

I think this is sort-of blocked by https://github.com/remotestorage/remotestorage.js/pull/904, or some similar effort. The current internals are too terrible to be exposed.

Found this: https://github.com/remotestorage/remotestorage.js/commit/a7b1e62

And the initial implementation: https://github.com/remotestorage/remotestorage.js/commit/f476e17

Now, there must have been a reason for this. It’s hard for me to understand what happened. Perhaps someone who’s been longer on the project can give me (us) a hint?

That’s a fantastic example for why it is so important to add the reason for a commit in the message. :wink:

@michielbdejong Do you remember why you removed it?

Also, anyone thinks it would hurt to re-introduce it?

Since there’s no way to currently do it, I’ve opened issue 914.

Still, it would be helpful to hear from older contributors.