Good afternoon, colleagues. I need your help. I am trying to implement a data synchronization service in my browser extension. For example, to synchronize notes, tasks, or bookmarks. The task is complicated because the user can edit his data without the network. And besides, he can start using the product without authorization and then authorize it into the existing account. This is my main problem.
Let’s assume this case study. The user logged in and got a complete, up-to-date copy of his data from the server. Then he logs out of the account. Yes, he lost contact with the server. But the local data remains, and he can edit them. The user created one new note and deleted one existing one. Then he logged back into his account.
I want the data already on the server to completely overwrite the data that the user edited locally without an account (what was on the server under the password cannot be overwritten by an anonymous user). And the new local data was synchronized with the server. This is the default behavior in, e.g., Google Chrome’s synchronization.
But I don’t understand how I can achieve this with Yjs. I would be glad to get any ideas.