parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.33k stars 597 forks source link

Local state of objects not correct if setting multiple properties #2115

Closed mortenmo closed 6 months ago

mortenmo commented 6 months ago

New Issue Checklist

Issue Description

When looking at #1798 found that setting multiple properties on the same object locally without saving reports the wrong object back. It will only show (this is true for set and unset) the latest Op you added to that property and not all. So setting data.b and data.c without saving (or you're offline), causes data.b to not be set.

When the object gets saved, the properties show up on get as expected.

Steps to reproduce

const myObj = new Parse.Object('MyClass');
myObj.set('data', {a: 5});
await myObj.save(null, {useMasterKey: true});

myObj.set('data.b', 2);
myObj.set('data.c', 2);

console.log(myObj.get('data'));

Actual Outcome

{ a: 5, c: 2}

Expected Outcome

{ a: 5, b: 2, c: 2}

Environment

Server

Client

parse-github-assistant[bot] commented 6 months ago

Thanks for opening this issue!

dplewis commented 6 months ago

Completed via https://github.com/parse-community/Parse-SDK-JS/pull/1451