Skip to content

Commit c9a23c4

Browse files
committed
Merge pull request #36 from ParsePlatform/andrewi.existed
Mark objects inflated from JSON as already existing
2 parents 66cf20a + 661d85b commit c9a23c4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/ParseObject.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,9 @@ export default class ParseObject {
12631263
}
12641264
}
12651265
o._finishFetch(otherAttributes);
1266+
if (json.objectId) {
1267+
o._setExisted(true);
1268+
}
12661269
return o;
12671270
}
12681271

src/__tests__/ParseObject-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,15 @@ describe('ParseObject', () => {
610610
expect(oldState.tasks).toBe(newState.tasks);
611611
});
612612

613+
it('marks inflated objects as existed', () => {
614+
var o = ParseObject.fromJSON({
615+
className: 'Item',
616+
objectId: 'iexist',
617+
count: 7
618+
});
619+
expect(o.existed()).toBe(true);
620+
});
621+
613622
it('can save the object', asyncHelper((done) => {
614623
CoreManager.getRESTController()._setXHR(
615624
mockXHR([{

0 commit comments

Comments
 (0)