From 7e5ce19a94a3b113db7be1361b5d009126c64e0a Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Tue, 1 Sep 2015 13:07:05 -0700 Subject: [PATCH] Fix diverging behavior of ReactFragment in `__DEV__` We could also remove the return statements but this is not a hot path and this seems safer. --- src/addons/ReactFragment.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/addons/ReactFragment.js b/src/addons/ReactFragment.js index d5862dd972..2c19261550 100644 --- a/src/addons/ReactFragment.js +++ b/src/addons/ReactFragment.js @@ -46,24 +46,23 @@ var ReactFragment = { // Wrap a keyed object in an opaque proxy that warns you if you access any // of its properties. create: function(object) { - if (__DEV__) { - if (typeof object !== 'object' || !object || Array.isArray(object)) { - warning( - false, - 'React.addons.createFragment only accepts a single object. Got: %s', - object - ); - return object; - } - if (ReactElement.isValidElement(object)) { - warning( - false, - 'React.addons.createFragment does not accept a ReactElement ' + - 'without a wrapper object.' - ); - return object; - } + if (typeof object !== 'object' || !object || Array.isArray(object)) { + warning( + false, + 'React.addons.createFragment only accepts a single object. Got: %s', + object + ); + return object; } + if (ReactElement.isValidElement(object)) { + warning( + false, + 'React.addons.createFragment does not accept a ReactElement ' + + 'without a wrapper object.' + ); + return object; + } + invariant( object.nodeType !== 1, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' +