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: WritekitDocument, next: WritekitDocument): WritekitDocument{ ... }

Parameters

ParameterTypeDescription
prevWritekitDocument
nextWritekitDocument

Returns

WritekitDocument
PropertyTypeDescription
type'doc'
contentreadonly Node[]