Skip to content

Conversation

iamadagostino
Copy link

Description

Prevent duplicate createRoot() calls by caching the root instance on the DOM element, fixing React 19 error on component remount.

Why

React 19 throws an error when ReactDOM.createRoot() is called multiple times on the same container. ScrollHtml was creating a new root on each remount, breaking compatibility with React 19.

What

  • Cache ReactDOM root instance on the DOM element using __r3_root property
  • Reuse cached root on component remount
  • Fixes React 19 compatibility while maintaining backwards compatibility

Checklist

  • Ready to be merged

Prevent duplicate createRoot() calls by caching the root instance on
the DOM element, fixing React 19 error on component remount.
Copy link

vercel bot commented Oct 13, 2025

@iamadagostino is attempting to deploy a commit to the Poimandres Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant