Skip to content

Instantly share code, notes, and snippets.

@jamestalmage
Last active October 14, 2015 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamestalmage/d57c19ebb58207245926 to your computer and use it in GitHub Desktop.
Save jamestalmage/d57c19ebb58207245926 to your computer and use it in GitHub Desktop.
Error in Firebase Demo

https://www.firebase.com/blog/2015-10-07-how-to-keep-your-data-consistent.html

function fanoutPost({ uid, followersSnaphot, post, postId }) {
  // Turn the hash of followers to an array of each id as the string
  var followers = Object.keys(followersSnaphot.val());
  var fanoutObj = {};
  // write to each follower's timeline
  // Correction: I think it needs something like this:
  followers.forEach((key) => fanoutObj['/timeline/' + key + '/' + postId] = post);
  return fanoutObj;  
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment