Skip to content
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

Saving pointer saves whole object #6049

Closed
mtrezza opened this issue Sep 13, 2019 · 4 comments · Fixed by parse-community/parse-dashboard#1291
Closed

Saving pointer saves whole object #6049

mtrezza opened this issue Sep 13, 2019 · 4 comments · Fixed by parse-community/parse-dashboard#1291
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@mtrezza
Copy link
Member

mtrezza commented Sep 13, 2019

Issue Description

Saving a User pointer in an array saves the whole object.
Possibly related to #691.

Steps to reproduce

  1. Open Parse Dashboard.
  2. Add a class with a column of type array.
  3. Add a pointer value of an existing user to the array, e.g.
[{
    "__type": "Pointer",
    "className": "_User",
    "objectId": "EXISTING_OBJECT_ID"
}]
  1. Pointer is saved correctly (check directly in DB, not via parse dashboard)
  2. Click on refresh in parse dashboard data browser.
  3. Item in array is not displayed as Pointer but as Object containing all fields, e.g.
[{
    "__type": "Object",
    "className": "_User",
    "objectId": "EXISTING_OBJECT_ID",
     (+ all other fields of the object)
}]
  1. Pointer is still saved correctly in DB (check directly in DB, not via parse dashboard)
  2. Double click on array field in parse dashboard and exit editing mode
  3. Pointer has been replaced by Object in DB

Notes:

  • This does not happen right after starting the server. It seems that the user needs to be cached or something. For me it happens when I do it in a class that contains a relation field where the user is added and I first add the user to an array there. The issue then occurs in every other class as well. I haven't quite nailed down the pattern yet.

  • The class where it occurs has no beforeSave / afterSave hook.

  • This actually seems to be a Parse Dashboard issue rather than a Parse Server issue.

Expected Results

Pointer value should be added to array as is.

Actual Outcome

The whole object is added to the array.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.4.4, 3.9.0
    • parse-dashboard version (Be specific! Don't say 'latest'.) : 2.0.2
    • Operating System: -
    • Hardware: -
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): -
  • Database

    • MongoDB version: 3.6.12
    • Storage engine: MongoDB
    • Hardware: -
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): -

Logs/Trace

(none)

@davimacedo davimacedo added type:bug Impaired feature or lacking behavior that is likely assumed needs investigation labels Sep 13, 2019
@davimacedo
Copy link
Member

It is probably a bug in the Parse Dashboard. It seems like a corner case of this bug that was recently addressed: parse-community/parse-dashboard#1223

I will take a look on this.

@davimacedo
Copy link
Member

This PR should fix it: parse-community/parse-dashboard#1291

@douglasmuraoka
Copy link
Contributor

I have found just one issue.
When editing the following array, its value is rendered correctly on parse-dashboard but the changes aren't persisted. When you hit the refresh button, "foo" attribute disappears.

[
  {
    "__type": "Pointer",
    "className": "_User",
    "objectId": "fRnZ0N8667",
    "foo": "bar"
  }
]

@davimacedo
Copy link
Member

@douglasmuraoka thanks for reporting. It should not save the attribute. So I pushed one more commit to the PR in which we do not show invalid pointers anymore after commiting a change. Can you please take a look again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants