Skip to content

[Bug]: flushSync error when remounting useEditor with existing ID and ReactNodeViewRenderer in React 19 #7543

@RaltzKlamar

Description

@RaltzKlamar

Affected Packages

react, extension-document, extension-text

Version(s)

3.14.0, 3.20.0

Bug Description

React 19 appears to have a bug in which some components in an array will remount if the array is reordered, even if every element is given a unique key tied to the data it represents. When the list is re-ordered, and we use the same id in the dependency array for useEditor, we get a flushSync error on any component which moved to be later in the list that uses a custom extension with a ReactNodeViewRenderer.

React 18 Sandbox: https://codesandbox.io/p/sandbox/tiptap-flushsync-reorder-18-w7ttcg
React 19 Sandbox: https://codesandbox.io/p/sandbox/tiptap-flushsync-reorder-19-x47nq7

This is likely related to any or all of #6315 #7438 #6386

Browser Used

Firefox

Code Example URL

https://codesandbox.io/p/sandbox/tiptap-flushsync-reorder-19-x47nq7

Expected Behavior

We do not get a flush sync error if useEditor remounts with the same dependency array

Additional Context (Optional)

  • The version where I first encountered this is 3.14.0
  • React core team is aware of the issue on their end

Dependency Updates

  • Yes, I've updated all my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Open SourceThe issue or pull reuqest is related to the open source packages of Tiptap.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions