Skip to content

[DevTools Bug]: useEffect hook incorrectly labelled as reason for component rendering #24182

Closed
@steinybot

Description

@steinybot

Website or app

https://codesandbox.io/s/react-devtools-useeffect-incorrect-render-reason-x3inwg

Repro steps

  1. Start profiling
  2. Click the button
  3. Stop profiling
  4. Check the reasons for rendering

Screen Shot 2022-03-28 at 10 48 57 AM

Screen Shot 2022-03-28 at 10 54 17 AM

It is incorrect to say that hook 2 is why this rendered. Hook 1 is why it rendered. Hook 2 was rescheduled during that render. These really need to be separated as they are completely different things. In a component with a lot of effects it can be tedious to find which hook was the one that caused it to render (especially with transpilling, minifying etc where hooks are not always shown nicely).

How often does this bug happen?

Every time

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)

No response

Error component stack (automated)

No response

GitHub query string (automated)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions