Skip to content
Merged
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
12 changes: 8 additions & 4 deletions packages/sync/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,19 @@ export function createSyncManager( debug = false ): SyncManager {
} )
);

// Attach observers.
recordMap.observeDeep( onRecordUpdate );
stateMap.observe( onStateMapUpdate );

// Initialize the Yjs document with the necessary CRDT state.
initializeYjsDoc( ydoc );

// Get and apply the persisted CRDT document, if it exists.
// Observers are attached after hydration so the applyUpdateV2 inside
// _applyPersistedCrdtDoc does not trigger _updateEntityRecord with the
// just-loaded state, which would dispatch a redundant editRecord whose
// blocks already match the editor's parsed content.
internal.applyPersistedCrdtDoc( objectType, objectId, record );

// Attach observers.
recordMap.observeDeep( onRecordUpdate );
stateMap.observe( onStateMapUpdate );
}

/**
Expand Down
Loading