Don't collapse nodes on hot reload

This commit is contained in:
Dan Abramov 2015-08-12 15:36:42 +03:00
parent f61d86a81d
commit e0d1f7f7a6

View File

@ -9,19 +9,18 @@ import JSONNullNode from './JSONNullNode';
export default function(key, value, prevValue, theme) { export default function(key, value, prevValue, theme) {
const nodeType = objType(value); const nodeType = objType(value);
const aKey = key + Date.now();
if (nodeType === 'Object') { if (nodeType === 'Object') {
return <JSONObjectNode data={value} previousData={prevValue} theme={theme} keyName={key} key={aKey} />; return <JSONObjectNode data={value} previousData={prevValue} theme={theme} keyName={key} key={key} />;
} else if (nodeType === 'Array') { } else if (nodeType === 'Array') {
return <JSONArrayNode data={value} previousData={prevValue} theme={theme} keyName={key} key={aKey} />; return <JSONArrayNode data={value} previousData={prevValue} theme={theme} keyName={key} key={key} />;
} else if (nodeType === 'String') { } else if (nodeType === 'String') {
return <JSONStringNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={aKey} />; return <JSONStringNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={key} />;
} else if (nodeType === 'Number') { } else if (nodeType === 'Number') {
return <JSONNumberNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={aKey} />; return <JSONNumberNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={key} />;
} else if (nodeType === 'Boolean') { } else if (nodeType === 'Boolean') {
return <JSONBooleanNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={aKey} />; return <JSONBooleanNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={key} />;
} else if (nodeType === 'Null') { } else if (nodeType === 'Null') {
return <JSONNullNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={aKey} />; return <JSONNullNode keyName={key} previousValue={prevValue} theme={theme} value={value} key={key} />;
} }
return false; return false;
} }