Skip to content

Commit 38d4c58

Browse files
douglasmuraokadplewis
authored andcommitted
fix(Database Browser): JSON conversion breaking file upload process (#1225)
1 parent e3c35a3 commit 38d4c58

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/dashboard/Data/Browser/BrowserTable.react.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class BrowserTable extends React.Component {
7878
});
7979
}
8080

81-
renderRow({ row, obj, json, rowWidth }) {
81+
renderRow({ row, obj, rowWidth }) {
8282
let attributes = obj.attributes;
8383
let index = row - this.state.offset;
8484
return (
@@ -103,10 +103,10 @@ export default class BrowserTable extends React.Component {
103103
attr.targetClassName = this.props.columns[name].targetClass;
104104
} else if (type === 'Array' || type === 'Object') {
105105
// This is needed to avoid unwanted conversions of objects to Parse.Objects.
106-
// When retrieving data from JSON, Parse-SDK will not try to convert any data.
106+
// "Parse._encoding" is responsible to convert Parse data into raw data.
107107
// Since array and object are generic types, we want to render them the way
108108
// they were stored in the database.
109-
attr = json[name];
109+
attr = Parse._encode(obj.get(name));
110110
}
111111
}
112112
let current = this.props.current && this.props.current.row === row && this.props.current.col === j;
@@ -176,7 +176,7 @@ export default class BrowserTable extends React.Component {
176176
for (let i = this.state.offset; i < end; i++) {
177177
let index = i - this.state.offset;
178178
let obj = this.props.data[i];
179-
rows[index] = this.renderRow({ row: i, obj, json: obj.toJSON(), rowWidth: rowWidth });
179+
rows[index] = this.renderRow({ row: i, obj, rowWidth: rowWidth });
180180
}
181181

182182
if (this.props.editing) {
@@ -199,17 +199,13 @@ export default class BrowserTable extends React.Component {
199199
}
200200
let obj = this.props.current.row < 0 ? this.props.newObject : this.props.data[this.props.current.row];
201201
let value = obj;
202-
let json = obj.toJSON();
203202
if (!this.props.isUnique) {
204203
if (type === 'Array' || type === 'Object') {
205-
if (!json) {
206-
json = obj.toJSON();
207-
}
208204
// This is needed to avoid unwanted conversions of objects to Parse.Objects.
209-
// When retrieving data from JSON, Parse-SDK will not try to convert any data.
205+
// "Parse._encoding" is responsible to convert Parse data into raw data.
210206
// Since array and object are generic types, we want to edit them the way
211207
// they were stored in the database.
212-
value = json[name];
208+
value = Parse._encode(obj.get(name));
213209
} else {
214210
value = obj.get(name);
215211
}

0 commit comments

Comments
 (0)