Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Overwrites externally modified data #27

Open
jjjjjjjjjjjjjjjjjjjj opened this issue Nov 8, 2017 · 3 comments
Open

Overwrites externally modified data #27

jjjjjjjjjjjjjjjjjjjj opened this issue Nov 8, 2017 · 3 comments

Comments

@jjjjjjjjjjjjjjjjjjjj
Copy link

Right now we seem to be sending the entire record to Firebase's update function, instead of just the properties that have been updated in AOR. This could cause problems. To illustrate:

  1. I open up user foo in AOR.
  2. User foo joins a group bar in My app.
  3. My app creates a relation users/foo/groups/bar in Firebase DB.
  4. I edit user foo's name to "John Doe" in AOR.
  5. I hit save in AOR.
  6. users/foo/groups/bar will be deleted from Firebase DB by AOR.
  7. users/foo/name will be set to "John Doe" in Firebase DB by AOR.
  8. User foo is no longer a member of group bar in my app.

Could it be solved by a comparison of params.previousData vs params.data before posting to firebase, then posting only the fields that have been changed?

@sidferreira
Copy link
Owner

sidferreira commented Nov 8, 2017

@janneklouman Good point! I have some big changes to upload now, it will be great if you can help me on this part :)

@sidferreira
Copy link
Owner

@janneklouman There's an UPLOAD branch with the new codes. Feel free to make the changes there.
It is a new version of the plugin including upload and other details

@sidferreira
Copy link
Owner

@janneklouman Reviewing this... It makes sense, but the problem is how deep can we handle that? The proper solution is a deepMerge, indeed, but need to plan how to integrate it

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

No branches or pull requests

2 participants