Don’t check for backgroundImageFn change in Category#shouldComponentUpdate

If the Fn is an anonymous function, it would always re-render the categories even when no other props change.
release
Etienne Lemay 2016-11-30 20:31:02 -05:00
parent b7761f6e32
commit 0d39e10a71
1 changed files with 3 additions and 3 deletions

View File

@ -17,9 +17,9 @@ export default class Category extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
var { name, perLine, hasStickyPosition, emojis, emojiProps } = this.props,
{ skin, size, set, backgroundImageFn } = emojiProps,
{ skin, size, set } = emojiProps,
{ perLine: nextPerLine, hasStickyPosition: nextHasStickyPosition, emojis: nextEmojis, emojiProps: nextEmojiProps } = nextProps,
{ skin: nextSkin, size: nextSize, set: nextSet, backgroundImageFn: nextBackgroundImageFn } = nextEmojiProps,
{ skin: nextSkin, size: nextSize, set: nextSet } = nextEmojiProps,
shouldUpdate = false
if (name == 'Recent' && perLine != nextPerLine) {
@ -30,7 +30,7 @@ export default class Category extends React.Component {
shouldUpdate = !(emojis == nextEmojis)
}
if (skin != nextSkin || size != nextSize || set != nextSet || hasStickyPosition != nextHasStickyPosition || backgroundImageFn != nextBackgroundImageFn) {
if (skin != nextSkin || size != nextSize || set != nextSet || hasStickyPosition != nextHasStickyPosition) {
shouldUpdate = true
}