Skip to content

Commit

Permalink
Merge pull request facebook#3132 from jsfb/warn-less-for-owner-necessary
Browse files Browse the repository at this point in the history
Only monitor components that are likely stateful (inputs and composites)
  • Loading branch information
jimfb committed Feb 13, 2015
2 parents 2a3f431 + f18dfdc commit 5512d0d
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/core/shouldUpdateReactComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,26 @@ function shouldUpdateReactComponent(prevElement, nextElement) {
nextElement.type.displayName != null) {
nextDisplayName = nextElement.type.displayName;
}
warning(
false,
'<%s /> is being rendered by both %s and %s using the same key ' +
'(%s) in the same place. Currently, this means that they ' +
'don\'t preserve state. This behavior should be very rare ' +
'so we\'re considering deprecating it. Please contact the ' +
'React team and explain your use case so that we can take that ' +
'into consideration.',
nextDisplayName || 'Unknown Component',
prevName || '[Unknown]',
nextName || '[Unknown]',
prevElement.key
);
if (nextElement.type != null && typeof nextElement.type === 'string') {
nextDisplayName = nextElement.type;
}
if (typeof nextElement.type !== 'string' ||
nextElement.type === 'input' ||
nextElement.type === 'textarea') {
warning(
false,
'<%s /> is being rendered by both %s and %s using the same key ' +
'(%s) in the same place. Currently, this means that they ' +
'don\'t preserve state. This behavior should be very rare ' +
'so we\'re considering deprecating it. Please contact the ' +
'React team and explain your use case so that we can take that ' +
'into consideration.',
nextDisplayName || 'Unknown Component',
prevName || '[Unknown]',
nextName || '[Unknown]',
prevElement.key
);
}
}
}
return ownersMatch;
Expand Down

0 comments on commit 5512d0d

Please sign in to comment.