@cicada/render
Advanced tools
Comparing version 1.1.8-alpha3 to 1.1.8-alpha4
@@ -32,6 +32,2 @@ 'use strict'; | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
exports.default = createAppearance; | ||
@@ -61,6 +57,10 @@ | ||
var isObject = function isObject(v) { | ||
return Object.prototype.toString.apply(v) === '[object Object]'; | ||
}; | ||
// 避免state数据传入到react开发版props属性被设置为frozen导致无法set | ||
function simpleCloneWithNofrozen(state) { | ||
if (!isObject(state)) return state; | ||
return (0, _util.mapValues)(state, function (v) { | ||
return (typeof v === 'undefined' ? 'undefined' : (0, _typeof3.default)(v)) === 'object' ? (0, _extends3.default)({}, v) : v; | ||
return isObject(v) ? (0, _extends3.default)({}, v) : v; | ||
}); | ||
@@ -183,3 +183,3 @@ } | ||
componentArg.props = (0, _extends3.default)({}, componentArg.props, injectedExternalProps); | ||
componentArg.state = componentArg.state ? simpleCloneWithNofrozen(componentArg.state) : componentArg.state; | ||
componentArg.state = simpleCloneWithNofrozen(componentArg.state); | ||
@@ -186,0 +186,0 @@ return _react2.default.createElement( |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.8-alpha3", | ||
"version": "1.1.8-alpha4", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
8656
358625