@tiptap/react 2.24.2 → 2.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import type {
8
8
  RefAttributes,
9
9
  } from 'react'
10
10
  import React, { version as reactVersion } from 'react'
11
+ import { flushSync } from 'react-dom'
11
12
 
12
13
  import { EditorWithContentComponent } from './Editor.js'
13
14
 
@@ -184,9 +185,18 @@ export class ReactRenderer<R = unknown, P extends Record<string, any> = object>
184
185
  this.element.classList.add(...className.split(' '))
185
186
  }
186
187
 
187
- queueMicrotask(() => {
188
- this.render()
189
- })
188
+ // If the editor is already initialized, we will need to
189
+ // synchronously render the component to ensure it renders
190
+ // together with Prosemirror's rendering.
191
+ if (this.editor.isInitialized) {
192
+ flushSync(() => {
193
+ this.render()
194
+ })
195
+ } else {
196
+ queueMicrotask(() => {
197
+ this.render()
198
+ })
199
+ }
190
200
  }
191
201
 
192
202
  /**