preact: While testing shouldComponentUpdate it seems that the this.props.children never equals nextProps.children
I was doing some testing on https://github.com/tkh44/shallow-compare and it seems that shouldComponentUpdate will always fail based on props being different. The property children
is always different.
I may be missing something or doing something wrong in my tests, but I felt like I should ask about it.
I created a branch with a logging so the issue could be seen here: https://github.com/tkh44/shallow-compare/tree/testing-preact-children. It is set up just like most of preact’s family of repos so just npm install
and npm t
.
Here is what i’m getting in the logs
prevProps {“color”:“red”,“children”:[“test”]} nextProps {“color”:“blue”,“children”:[“test”]} color is not equal value a: red value b: blue propsDiffers true stateDiffers false shouldComponentUpdate true color is not equal value a: red value b: blue propsDiffers true stateDiffers false render blue
prevProps {“color”:“blue”,“children”:[“test”]} nextProps {“color”:“blue”,“children”:[“test”]} children is not equal value a: [ ‘test’ ] value b: [ ‘test’ ] propsDiffers true stateDiffers false shouldComponentUpdate true children is not equal value a: [ ‘test’ ] value b: [ ‘test’ ] propsDiffers true stateDiffers false render blue
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (17 by maintainers)
Ack! I messed up and the dist-tag change hadn’t gone through. It’s there now and I updated the releases page.
Ha that explains it! Thanks Jason!
@Download
7.2
was only released under thebeta
dist-tag. When you donpm i preact
you are only ever going to getlatest
dist-tag releases. I just rolled7.2
over tolatest
though, sonpm i preact
should now give you 7.2 😃