Skip to content

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

Open
@fabiozaffani

Description

@fabiozaffani

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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions