R
fn

reconcileDoc

tested

Build a document equal to `next` but reusing block-node identities from `prev` wherever a block is deep-equal — so applying a remote change repaints only the blocks that actually changed (others keep their reference, and the local caret in them is undisturbed). Returns `prev` unchanged when nothing differs.

Signature

ts
export function reconcileDoc(prev: EditorDocument, next: EditorDocument): EditorDocument{ ... }

Parameters

ParameterTypeDescription
prevEditorDocument
nextEditorDocument

Returns

EditorDocument