Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React 19] dangerouslySetInnerHTML causes repaint #31660

Open
lukahartwig opened this issue Dec 3, 2024 · 1 comment
Open

[React 19] dangerouslySetInnerHTML causes repaint #31660

lukahartwig opened this issue Dec 3, 2024 · 1 comment
Labels

Comments

@lukahartwig
Copy link

lukahartwig commented Dec 3, 2024

Summary

Given the following component

function App() {
  const [count, setCount] = useState(0);

  return (
    <>
      <button onClick={() => setCount((count) => count + 1)}>{count}</button>
      <div dangerouslySetInnerHTML={{ __html: "I should only paint once" }} />
    </>
  );
}

Clicking the button should not trigger a repaint of "I should only paint once". This works as expected in react@18.3.1 but not in react@19.0.0-rc.1 or react@0.0.0-experimental-5b0ef217-20241202.

  • Browser: Chrome Version 131.0.6778.86 (Official Build) (arm64)
  • OS: MacOS 15.1.1 (24B91)

react@18.3.1

Screen.Recording.2024-12-03.at.13.16.43.mov

react@0.0.0-experimental-5b0ef217-20241202

Screen.Recording.2024-12-03.at.13.17.50.mov

Source Code

@lukahartwig
Copy link
Author

I did some bisecting

Last good version: 18.3.0-next-41b4714f1-20230328
First bad version: 18.3.0-next-85de6fde5-20230328

The issue seems to be caused by this refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant