Skip to content

Commit

Permalink
Save a reference to the snapshot on the immutable value
Browse files Browse the repository at this point in the history
This allows us to later get a firebase reference to it and to get it's
priority, among other nice things.
  • Loading branch information
JustinTulloss committed Jan 28, 2015
1 parent 009c993 commit 391dad3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/reactfire.js
Expand Up @@ -133,7 +133,9 @@ var ReactFireMixin = {
else if (typeof(snapshot) === "object") {
out = out.withMutations(function(map) {
snapshot.forEach(function(child) {
map.set(child.key(), Immutable.fromJS(child.val()));
var immutableChild = Immutable.fromJS(child.val());
immutableChild.snapshot = child;
map.set(child.key(), immutableChild);
});
});
}
Expand All @@ -151,7 +153,9 @@ var ReactFireMixin = {
else if (typeof(snapshot) === "object") {
out = out.withMutations(function(list) {
snapshot.forEach(function(child) {
list.push(Immutable.fromJS(child.val()));
var immutableChild = Immutable.fromJS(child.val());
immutableChild.snapshot = child;
list.push(immutableChild);
});
});
}
Expand Down

0 comments on commit 391dad3

Please sign in to comment.