🐛(frontend) fix bug multi ws connection

In collaborative mode, only the first document
connected was being shared. This was due to the
fact that the webrtc server was managing only
one connection at a time. This commit fixes this
bug by managing multiple connections.
This commit is contained in:
Anthony LC
2024-06-12 16:34:56 +02:00
committed by Anthony LC
parent 9e318f88be
commit 62098ec753
2 changed files with 26 additions and 9 deletions

View File

@@ -24,7 +24,9 @@ const initialState = {
export const usePadStore = create<PadStore>((set) => ({
padsStore: initialState.padsStore,
createProvider: (padId: string, initialDoc: Base64) => {
const doc = new Y.Doc();
const doc = new Y.Doc({
guid: padId,
});
if (initialDoc) {
Y.applyUpdate(doc, Buffer.from(initialDoc, 'base64'));