Skip to content

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

Closed
@mortenmo

Description

@mortenmo

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

  • Parse Server version: 7.0.0
  • Operating system: OSX
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Client

  • Parse JS SDK version: 5.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions