Skip to content

Commit 2acc521

Browse files
davimacedodouglasmuraoka
authored andcommitted
Fix: Force pointer array items to always be pointers (#1291)
* Force pointer array items to always be pointers * Do not show invalid pointers after committing a change in an array or object field
1 parent acb6229 commit 2acc521

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/components/BrowserRow/BrowserRow.react.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Parse from 'parse';
2+
import encode from 'parse/lib/browser/encode';
23
import React, { Component } from 'react';
34

45
import BrowserCell from 'components/BrowserCell/BrowserCell.react';
@@ -46,7 +47,7 @@ export default class BrowserRow extends Component {
4647
// "Parse._encoding" is responsible to convert Parse data into raw data.
4748
// Since array and object are generic types, we want to render them the way
4849
// they were stored in the database.
49-
attr = Parse._encode(obj.get(name));
50+
attr = encode(obj.get(name), undefined, true);
5051
}
5152
}
5253
let hidden = false;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Editor from 'dashboard/Data/Browser/Editor.react';
1212
import EmptyState from 'components/EmptyState/EmptyState.react';
1313
import Icon from 'components/Icon/Icon.react';
1414
import Parse from 'parse';
15+
import encode from 'parse/lib/browser/encode';
1516
import React from 'react';
1617
import styles from 'dashboard/Data/Browser/Browser.scss';
1718
import Button from 'components/Button/Button.react';
@@ -198,7 +199,7 @@ export default class BrowserTable extends React.Component {
198199
// "Parse._encoding" is responsible to convert Parse data into raw data.
199200
// Since array and object are generic types, we want to edit them the way
200201
// they were stored in the database.
201-
value = Parse._encode(obj.get(name));
202+
value = encode(obj.get(name), undefined, true);
202203
} else {
203204
value = obj.get(name);
204205
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import FileEditor from 'components/FileEditor/FileEditor.react';
1212
import GeoPointEditor from 'components/GeoPointEditor/GeoPointEditor.react';
1313
import NumberEditor from 'components/NumberEditor/NumberEditor.react';
1414
import Parse from 'parse';
15+
import decode from 'parse/lib/browser/decode';
1516
import React from 'react';
1617
import StringEditor from 'components/StringEditor/StringEditor.react';
1718

@@ -30,7 +31,7 @@ let Editor = ({ top, left, type, targetClass, value, readonly, width, onCommit }
3031
} else if (type === 'Array' || type === 'Object') {
3132
let encodeCommit = (json) => {
3233
try {
33-
let obj = JSON.parse(json);
34+
let obj = decode(JSON.parse(json));
3435
onCommit(obj);
3536
} catch (e) {
3637
onCommit(value);

0 commit comments

Comments
 (0)