Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ maintenance for you.

<Banner title="Interactive tutorial">

Our [interactive React tutorial](/tutorial/react/storage) guides you through
Our [interactive React tutorial](/docs/tutorial/react/getting-started/storage) guides you through
using each of the concepts listed on this page.

</Banner>
Expand Down
12 changes: 7 additions & 5 deletions packages/liveblocks-server/src/YjsStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ export class YjsStorage {
doc: Y.Doc,
docId: YDocId
): Promise<Y.Doc> => {
const storedKeys: string[] = [];
for (const [key, update] of await this.driver.iter_y_updates(docId)) {
Y.applyUpdate(doc, update);
storedKeys.push(key);
}
const docUpdates = Object.fromEntries(
await this.driver.iter_y_updates(docId)
);
const updates = Object.values(docUpdates);
const newupdate = Y.mergeUpdates(updates);
const storedKeys = Object.keys(docUpdates);
Y.applyUpdate(doc, newupdate);
// after compaction, there will only be one unique key.
if (this.shouldCompact(storedKeys)) {
await this._compactYJSUpdates(doc, docId, storedKeys);
Expand Down
Loading