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

Update() should use Ref#update instead of Ref#set #22

Open
fabiozaffani opened this issue Jan 24, 2016 · 1 comment
Open

Update() should use Ref#update instead of Ref#set #22

fabiozaffani opened this issue Jan 24, 2016 · 1 comment
Assignees
Labels

Comments

@fabiozaffani
Copy link

This is related to the #20 , because the same problem that arrives when trying to delete the data, also happens when you try to update the firebase data from more than one place at once, because of the use of the .set method instead of the .update.

For example, let's say we have a site with a cart, and the user is updating the cart at the site (changing product quantities) and we wan't to keep the shipment updated. If we try to update only the shipment field of the cart, it will also override the product's (that the user might have already updated) since it will fetch the data from the database, merge it with the new shipment value and then .set() it.

My doubt is, there are any reason why the .set are used instead of the .update method from firebase? Doing the .update and not trying to merge the data would fix both this and the #20 issue.

@fabiozaffani fabiozaffani changed the title Async data problem with the upate() method Async data problem with the update() method Jan 24, 2016
@jmdobry jmdobry changed the title Async data problem with the update() method Update() should use Ref#update instead of Ref#set Sep 20, 2016
@jmdobry jmdobry added the bug label Sep 20, 2016
@jmdobry
Copy link
Member

jmdobry commented Sep 20, 2016

In 3.x this has been fixed for updateAll and updateMany. I'm not sure why it wasn't fixed for update.

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

No branches or pull requests

3 participants