Skip to content

Component with shouldComponentUpdate won't get re-rendered when its parent component is updated at the same time #3883

@kmxz

Description

@kmxz

Reproduced with Preact 10.11.3.

Describe the bug

For a component with shouldComponentUpdate (for example, a PureComponent), calling setState with a new state value does not cause it to re-render, if the parent component is updated at the same time.

To Reproduce

https://codepen.io/kmxz/pen/bGjzvbR

Expected behavior

In the example above, the new state.text value "Child-NEW" should be rendered, instead of the stale state.text value "child-old".

Rendering the exact same demo code using React gives the correct behavior (https://codepen.io/kmxz/pen/rNrPJEq).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions