Skip to content

Commit

Permalink
Find callsites that would call toString() if we pass attributes throu…
Browse files Browse the repository at this point in the history
…gh (#10416)

* Find callsites that would call toString() if we pass attributes through

* Warn for all object unknown props, not just 'toString' ones

fixing this as per Sebastian's feedback, because we want to find all
objects and not just ones with 'toString' defined. Because there may be
other corner cases and issues that are revealed.
  • Loading branch information
gaearon authored and flarnie committed Aug 11, 2017
1 parent 4d08914 commit 58e6ede
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ var warnUnknownProperties = function(type, props, debugID) {
var isValid = validateProperty(type, key, debugID);
if (!isValid) {
unknownProps.push(key);
var value = props[key];
if (typeof value === 'object' && value !== null) {
warning(
false,
'The %s prop on <%s> is not a known property, and was given an object.' +
'Remove it, or it will appear in the ' +
'DOM after a future React update.%s',
key,
type,
getStackAddendum(debugID),
);
}
}
}

Expand Down

0 comments on commit 58e6ede

Please sign in to comment.