More informative error message for mergeObjectsWithNoDuplicateKeys
This commit is contained in:
parent
ed27c89748
commit
dcdc35fab6
|
@ -592,7 +592,12 @@ function mergeObjectsWithNoDuplicateKeys(one, two) {
|
|||
invariant(
|
||||
one[key] === undefined,
|
||||
'mergeObjectsWithNoDuplicateKeys(): ' +
|
||||
'Tried to merge two objects with the same key: %s',
|
||||
'Tried to merge two objects with the same key: `%s`. ' +
|
||||
'This conflict may be due to a mixin; in particular, you may be using ' +
|
||||
'a mixin with its own getDefaultProps() or getInitialState(). This ' +
|
||||
'could result in both the mixin and base component (or another mixin) ' +
|
||||
'returning an object (either from getDefaultProps() or ' +
|
||||
'getInitialState()) with the same key.',
|
||||
key
|
||||
);
|
||||
one[key] = value;
|
||||
|
|
|
@ -688,7 +688,12 @@ describe('ReactCompositeComponent', function() {
|
|||
instance = ReactTestUtils.renderIntoDocument(instance);
|
||||
}).toThrow(
|
||||
'Invariant Violation: mergeObjectsWithNoDuplicateKeys(): ' +
|
||||
'Tried to merge two objects with the same key: x'
|
||||
'Tried to merge two objects with the same key: `x`. ' +
|
||||
'This conflict may be due to a mixin; in particular, you may be using ' +
|
||||
'a mixin with its own getDefaultProps() or getInitialState(). This ' +
|
||||
'could result in both the mixin and base component (or another mixin) ' +
|
||||
'returning an object (either from getDefaultProps() or ' +
|
||||
'getInitialState()) with the same key.'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue