Skip to content

Commit e352475

Browse files
committed
Don't blow up on missing _store in element validation
Seems better to fail gracefully, especially now that we support inlining. If people do this by accident we can figure out how to add a helpful warning instead. Fixes #3285.
1 parent 530b633 commit e352475

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/isomorphic/classic/element/ReactElementValidator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var loggedTypeFailures = {};
5757
* @param {*} parentType element's parent's type.
5858
*/
5959
function validateExplicitKey(element, parentType) {
60-
if (element._store.validated || element.key != null) {
60+
if (!element._store || element._store.validated || element.key != null) {
6161
return;
6262
}
6363
element._store.validated = true;

src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,20 @@ describe('ReactElementValidator', function() {
467467
}
468468
});
469469

470+
it('does not blow up with inlined children', function() {
471+
// We don't suggest this since it silences all sorts of warnings, but we
472+
// shouldn't blow up either.
473+
474+
var child = {
475+
$$typeof: (<div />).$$typeof,
476+
type: 'span',
477+
key: null,
478+
ref: null,
479+
props: {},
480+
_owner: null,
481+
};
482+
483+
void <div>{[child]}</div>;
484+
});
485+
470486
});

0 commit comments

Comments
 (0)