Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

toJSON() repeats pending updates to nested keys

Open mstniy opened this issue 3 years ago • 3 comments

New Issue Checklist

Issue Description

If there are pending updates to nested fields, the object returned by toJSON() is corrupted.

Steps to reproduce

a = new Parse.Object("MyObject");
a.set('obj', {});
await a.save();
a.set('obj.a', 0);
console.log(a.toJSON());

Actual Outcome

Prints an object with the keys {obj: {a: 0}, 'obj.a': 0}

Expected Outcome

Should print roughly {obj: {a: 0}}

Environment

Server

  • Parse Server version: irrelevant
  • Operating system: Ubuntu 20.04
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 5.0.6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • Parse JS SDK version: alpha (d084ac9be058d9b13f8ac2bbf04615f76dc2800d)

Logs

mstniy avatar Feb 16 '22 10:02 mstniy

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

Did you mix expected and actual outcome?

mtrezza avatar Feb 16 '22 22:02 mtrezza

Whoops. Fixed.

mstniy avatar Feb 16 '22 23:02 mstniy

🎉 This change has been released in version 5.1.0-alpha.8

parseplatformorg avatar May 02 '24 23:05 parseplatformorg

🎉 This change has been released in version 5.1.0-beta.1

parseplatformorg avatar May 16 '24 12:05 parseplatformorg

🎉 This change has been released in version 5.1.0

parseplatformorg avatar May 16 '24 13:05 parseplatformorg