Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side reloaded ydoc version is getting overwritten by client-side version upon page refresh #161

Open
nvanhoeck-dpgmedia opened this issue Oct 30, 2023 · 0 comments
Labels
wontfix This will not be worked on

Comments

@nvanhoeck-dpgmedia
Copy link

Hi there!

My team at DPG-Media have a question about the way we need to deal with something we encountered implementing the YJS-websocket-provider in our codebase. We have a frontend setup which uses SyncedStore and the yjs Websocket-provider to setup a communication between clients and the websocket-server. The communication goes pretty well, aside from some quirks.

The use case is that we want server updates, coming from a database change, to be sent to the websocket-server and cause a complete replacement of the Ydoc where the clients currently are working on in the browser. We have implemented a locking and warning mechanism, so that the document is temporarily locked for editing by manual edits.

We have discovered that something goes wrong with reloading the ydoc into the front-end upon refreshing the page. When only a single client has its browser open and he refreshes the page after the yDoc has been replaced with a newer version, everything goes well and we see a new version being reloaded.
But when multiple clients have their browser open and one of them refreshes, we see that the clients 'version' gets loaded back again after the refresh, not the one coming from the database.

We have a difficult time to wrap our head around this one, since it is pure in the chronological way the websockets messages are sent. When tracking it down in our code, we see that the change from the database get applied first, but upon refresh, the version the clients gets applied afterwards.

Do you have any suggestions or examples how to deal with server-side updates to an Y-Doc that is being used?
What causes that the version opened on multiple browsers gets reloaded on another clients page after a refresh, even when there is an update by the websocket-server replacing the y.doc with the new content?

If more info is required, please let me know and I'll see to it I can get it provided to you.

Thanks in advance.

@nvanhoeck-dpgmedia nvanhoeck-dpgmedia added the wontfix This will not be worked on label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant