Queue flushSync microtask (#3533)

Do the same thing as https://github.com/ueberdosis/tiptap/pull/3188
This commit is contained in:
Kyle Alwyn 2023-02-18 13:47:11 -08:00 committed by GitHub
parent 26c349848e
commit aa4389883a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,9 @@ export class PureEditorContent extends React.Component<EditorContentProps, Edito
// lifecycle methods, and React doesn't allow calling flushSync from inside // lifecycle methods, and React doesn't allow calling flushSync from inside
// a lifecycle method. // a lifecycle method.
if (this.initialized) { if (this.initialized) {
flushSync(fn) queueMicrotask(() => {
flushSync(fn)
})
} else { } else {
fn() fn()
} }