Skip to content

[React 19] dangerouslySetInnerHTML causes repaint #31660

Open
@lukahartwig

Description

@lukahartwig

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 [email protected] but not in [email protected] or [email protected].

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

[email protected]

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

[email protected]

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

Source Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions