Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kmxz opened this issue Feb 4, 2023 · 1 comment · Fixed by #3884

Comments

@kmxz
Copy link

kmxz commented Feb 4, 2023

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).

@JoviDeCroock
Copy link
Member

Hey, thank you for the accurate reproduction this was an error in how we deal with strict equality and we have a fix lined up in #3884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants