Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Does "Trace React Updates" respect shouldComponentUpdate short-circuits? #337

@stipsan

Description

@stipsan

It looks to me as if shouldComponentUpdate checks counts as an update in the devtools.
Even if a component return false on sCU it will flash as updated. Child components of a falsy sCU won't flash, suggesting that sCU is probably not tracing renders per-se but the componentWillReceiveProps part of the lifecycle.

Here's a codepen to see what I'm talking about: http://codepen.io/stipsan/pen/grbaEr

With "Trace React Updates" flipped on I'd expect the first input to flash itself and its parent when you change the value. The second input guard itself with a sCU for its local state.
But it flashes, suggesting the sCU returned true when it actually returned false.
If the second input is changed, it'll only update its local state and the devtools will show a trace for just the second input, just as you'd expect.

If this is the intended behavior, then it should be much more clear so that lesser experienced devs isn't mislead into thinking pure components are rendering when they aren't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions