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).
Reproduced with Preact 10.11.3.
Describe the bug
For a component with
shouldComponentUpdate(for example, aPureComponent), callingsetStatewith 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.textvalue "Child-NEW" should be rendered, instead of the stalestate.textvalue "child-old".Rendering the exact same demo code using React gives the correct behavior (https://codepen.io/kmxz/pen/rNrPJEq).