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

Object from Parse in LocalDatastore with the local id doesn't update when I execute the pin function again #792

Closed
natalio opened this issue Apr 12, 2019 · 1 comment · Fixed by #795

Comments

@natalio
Copy link

natalio commented Apr 12, 2019

Issue Description

I did a search in local Datastore for an object with the local id and try to update one of its attributes, but instead of customizing it it adds a new object in the localDatastore when I execute the pin function again.

Steps to reproduce

const query = new Parse.Query("Todos");
query.fromLocalDatastore();
let todos = await query.find()
for(let i=0; todos.length;i++){
  if(todos[i].get("done") == false){
   todos[i].set("done", true);
   todos[i].pin();
  }
}

Environment Setup

  • Server

    • parse-server version : 3.2.3
    • Operating System: Linux/Ubuntu
    • Localhost or remote server? : Localhost
  • JS SDK

    • JS SDK version: 2.3.2
    • Application?: React-Native
@natalio natalio changed the title Object from Parse in LocalDatastore with the local id does not update when I execute the pin function again Object from Parse in LocalDatastore with the local id doesn't update when I execute the pin function again Apr 12, 2019
@dplewis
Copy link
Member

dplewis commented Apr 12, 2019

I think I see what you are trying to do.

Can you write a failing test here?

dplewis added a commit that referenced this issue Apr 13, 2019
Closes: #792

Saves _localId into the LocalDatastore to keep consistency when querying.
@natalio natalio closed this as completed Apr 16, 2019
dplewis added a commit that referenced this issue Apr 23, 2019
* LDS: Improve pinning unsaved objects

Closes: #792

Saves _localId into the LocalDatastore to keep consistency when querying.

* add missing commit

* more tests

* remove console.log

* updateFromServer ignore unsaved objects

* Update package-lock.json

* Revert "Update package-lock.json"

This reverts commit 379935a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants