Skip to content

"should deep save and update nested objects" test failing #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
acinader opened this issue Jul 5, 2016 · 1 comment
Closed

"should deep save and update nested objects" test failing #40

acinader opened this issue Jul 5, 2016 · 1 comment

Comments

@acinader
Copy link
Contributor

acinader commented Jul 5, 2016

see parse-community/Parse-SDK-JS#89

but is still failing.

@acinader
Copy link
Contributor Author

acinader commented Jul 7, 2016

I started to investigate this. I was able to prove that there was an issue by running the test code against an actual parse backend. I could confirm that after saving the brand using mockdb, the items array is an array of pointers, but when saving against a parse backend, the items array is an array of items.

I tried some debug printing in the parse code to see if i could figure out where the two diverged. I didn't get very far.

Good practice for understanding the internals of parse a bit, I guess :)

I added some console.logs to ParseObject.js in the _handleSaveResponse function (line 392 in my lib).

      var pending = stateController.popPendingState(this._getStateIdentifier());
      console.log(pending);
      console.log(response);
      console.log(status);
      for (attr in pending) {

when running the test with mockdb, the output:

{ price: SetOp { _value: 30 },
  country_code: SetOp { _value: 'US' } }
{ price: 30,
  country_code: 'US',
  objectId: '1',
  createdAt: '2016-07-07T12:49:55.230Z' }
200
{ name: SetOp { _value: 'Acme' },
  country: SetOp { _value: 'US' },
  items: SetOp { _value: [ [Object] ] } }
{ items: [ { __type: 'Pointer', className: 'Item', objectId: '1' } ],
  name: 'Acme',
  country: 'US',
  objectId: '2',
  createdAt: '2016-07-07T12:49:55.243Z' }
201

when running against a real parse backend:

{ price: SetOp { _value: 30 },
  country_code: SetOp { _value: 'US' } }
{ createdAt: '2016-07-07T12:50:30.987Z',
  objectId: 'zSfvJnEwPc' }
200
{ name: SetOp { _value: 'Acme' },
  country: SetOp { _value: 'US' },
  items: SetOp { _value: [ [Object] ] } }
{ createdAt: '2016-07-07T12:50:31.191Z',
  objectId: '5HarZcu8Ug' }
201

So maybe there is something downstream of this that makes a decision based on what the object look like, but I more or less lose the path here. Will pick back up again.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant