From 8b0bd1d04d64fc5a1eec2e118c39780a42a74d38 Mon Sep 17 00:00:00 2001 From: Ulion Date: Mon, 8 Feb 2021 11:54:26 +0800 Subject: [PATCH] Continue fix for mixed apply remote operations ops and non-ops. --- packages/client/src/automerge-editor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/automerge-editor.ts b/packages/client/src/automerge-editor.ts index dccab63..4cfbe8f 100644 --- a/packages/client/src/automerge-editor.ts +++ b/packages/client/src/automerge-editor.ts @@ -125,6 +125,8 @@ export const AutomergeEditor = { if (operations.length) { const slateOps = toSlateOp(operations, current) + // do not change isRemote flag for no-op case. + const wasRemote = e.isRemote e.isRemote = true Editor.withoutNormalizing(e, () => { @@ -145,7 +147,7 @@ export const AutomergeEditor = { // XXX: only schedule set isRemote false when we did scheduled onChange by apply. Promise.resolve().then(_ => (e.isRemote = false)) } else { - e.isRemote = false + e.isRemote = wasRemote } } } catch (e) {