From b9b8dd44c52d76f40a2327071cda38d836787b8f Mon Sep 17 00:00:00 2001 From: Angela Guo Date: Fri, 10 Jul 2026 11:34:00 -0700 Subject: [PATCH 1/2] Skip flushSync if skipFlushSync meta is set on transaction --- .yarn/versions/a8b09489.yml | 2 ++ src/hooks/useEditor.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .yarn/versions/a8b09489.yml diff --git a/.yarn/versions/a8b09489.yml b/.yarn/versions/a8b09489.yml new file mode 100644 index 00000000..206c26a6 --- /dev/null +++ b/.yarn/versions/a8b09489.yml @@ -0,0 +1,2 @@ +releases: + "@handlewithcare/react-prosemirror": patch diff --git a/src/hooks/useEditor.ts b/src/hooks/useEditor.ts index a962a68f..f5b273c7 100644 --- a/src/hooks/useEditor.ts +++ b/src/hooks/useEditor.ts @@ -71,7 +71,8 @@ export function useEditor( const dispatchTransaction = useCallback( function dispatchTransaction(this: EditorView, tr: Transaction) { - if (flushSyncRef.current) { + const skipFlushSync = tr.getMeta("skipFlushSync"); + if (flushSyncRef.current && !skipFlushSync) { flushSync(() => { if (!options.state) { setState((s) => s.apply(tr)); From 397b21f327f559ee4de7b808ceca5e5572c6f37b Mon Sep 17 00:00:00 2001 From: Angela Guo Date: Fri, 10 Jul 2026 11:42:36 -0700 Subject: [PATCH 2/2] rename to async --- src/hooks/useEditor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useEditor.ts b/src/hooks/useEditor.ts index f5b273c7..a9b4e4ca 100644 --- a/src/hooks/useEditor.ts +++ b/src/hooks/useEditor.ts @@ -71,8 +71,8 @@ export function useEditor( const dispatchTransaction = useCallback( function dispatchTransaction(this: EditorView, tr: Transaction) { - const skipFlushSync = tr.getMeta("skipFlushSync"); - if (flushSyncRef.current && !skipFlushSync) { + const async = tr.getMeta("async"); + if (flushSyncRef.current && !async) { flushSync(() => { if (!options.state) { setState((s) => s.apply(tr));