Skip to content

Commit

Permalink
Update y-indexeddb.js
Browse files Browse the repository at this point in the history
start update after sync to avoid yjs#25 and yjs#31 and listen for updates after the sync to avoid duplicating updates.

Client will need to ensure no updates are made before sync is completed. A more robust implementation would need to queue updates.
  • Loading branch information
disarticulate authored Jun 12, 2024
1 parent 6084e84 commit ba56289
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/y-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class IndexeddbPersistence extends Observable {
}
}
}
doc.on('update', this._storeUpdate)
this.whenSynced.then(() => doc.on('update', this._storeUpdate))
this.destroy = this.destroy.bind(this)
doc.on('destroy', this.destroy)
}
Expand Down

0 comments on commit ba56289

Please sign in to comment.