Skip to content

[DevTools] Console logging and StrictMode double rendering #21889

Closed

Description

@bvaughn

React currently suppress all console logs while double rendering (or double invoking render phase lifecycles) to reduce console noise, e.g.:
https://github.com/facebook/react/blob/310187264d01a31bc3079358f13662d31a079d9e/packages/react-reconciler/src/ReactFiberBeginWork.new.js#L366-L384

Unfortunately this often causes confusion and leads to complaints (see the discussion on #21783). We could leverage DevTools to improve the default experience and give developers control over this behavior.

  • Disable console suppression by default in React.
  • Add an API for DevTools and React to communicate about when double rendering (or lifecycles) start and stop.
  • DevTools should gray out (but not hide) logs during second render pass by default.
  • DevTools should expose a new Debugging preference that allows users to suppress second logs entirely (mimicking the current default behavior).

Activity

  1. md-ziauddin commented on Aug 3, 2021

    @md-ziauddin

    I would like to work on this. If nobody is working on this. I can start working on exposing new debugging preferences as mentioned above. Could you please clarify the second point about adding an API for DevTools and React to communicate.

    @bvaughn

  2. bvaughn commented on Aug 3, 2021

    @bvaughn
    ContributorAuthor

    Thanks for the offer, @ziauddin-copods, but Luna Ruan is working on this task. (It's assigned to her.)

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions