From 417654d27c6c0750d48f515cff61e0942cfee3a5 Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Tue, 8 Mar 2016 19:57:22 -0800 Subject: [PATCH] Fix issues with arrays contiaining null or pointers to users. Fixes #105. --- src/components/BrowserCell/BrowserCell.react.js | 16 +++++----------- src/dashboard/Data/Browser/BrowserTable.react.js | 4 +--- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/BrowserCell/BrowserCell.react.js b/src/components/BrowserCell/BrowserCell.react.js index 1057b7511c..7b5d82d503 100644 --- a/src/components/BrowserCell/BrowserCell.react.js +++ b/src/components/BrowserCell/BrowserCell.react.js @@ -39,16 +39,10 @@ let BrowserCell = ({ type, value, hidden, width, current, onSelect, readonly, on content = dateStringUTC(value); } else if (type === 'Boolean') { content = value ? 'True' : 'False'; - } else if (type === 'Array' || type === 'Object') { - if (type === 'Array') { - let _value = []; - value.forEach((val) => { - _value.push(val.constructor === Parse.Object ? val.toPointer() : val); - }); - content = JSON.stringify(_value); - } else { - content = JSON.stringify(value); - } + } else if (type === 'Array') { + content = JSON.stringify(value.map(val => val instanceof Parse.Object ? val.toPointer() : val)) + } else if (type === 'Object') { + content = JSON.stringify(value); } else if (type === 'File') { if (value.url()) { content = ; @@ -85,7 +79,7 @@ let BrowserCell = ({ type, value, hidden, width, current, onSelect, readonly, on ); } - + if (current) { classes.push(styles.current); } diff --git a/src/dashboard/Data/Browser/BrowserTable.react.js b/src/dashboard/Data/Browser/BrowserTable.react.js index 57d60670de..1ac36cd830 100644 --- a/src/dashboard/Data/Browser/BrowserTable.react.js +++ b/src/dashboard/Data/Browser/BrowserTable.react.js @@ -202,9 +202,7 @@ export default class BrowserTable extends React.Component { value = ''; } else if (type === 'Array') { if (value) { - value = value.map((val) => { - return val.constructor === Parse.Object ? val.toPointer() : val; - }); + value = value.map(val => val instanceof Parse.Object ? val.toPointer() : val); } } let wrapTop = Math.max(0, this.props.current.row * ROW_HEIGHT);