GoogleWebComponents / firebase-element

Web components for the Firebase Web API
https://elements.polymer-project.org/elements/firebase-element
95 stars 72 forks source link

two consecutive changes to bound data causes error in _applySubPathChange #119

Closed ryanwtyler closed 8 years ago

ryanwtyler commented 8 years ago

i have a custom element bound to a firebase-collection element. I make two changes to my custom element's data:

this.set('lifter.bestSnatch', objData.weight);
this.set('lifter.total', objData.weight);

the first one is fine. the second one causes an error here in firebase-collection.html line 331:

_applySubPathChange: function(change) {
        var key = change.path.split('.')[1];
        var value = Polymer.Collection.get(change.base).getItem(key);
        var firebaseKey = value.__firebaseKey__;

        // We don't want to accidentally reflect `__firebaseKey__` in the
        // remote data, so we remove it temporarily. `null` values will be
        // discarded by Firebase, so `delete` is not necessary:
        value.__firebaseKey__ = null;
        this.query.ref().child(firebaseKey).set(value);
        value.__firebaseKey__ = firebaseKey;
      },

somehow the key to the item being updated gets changes from "3" to 4. so var value = Polymer.Collection.get(change.base).getItem(key); returns "undefined"

MeTaNoV commented 8 years ago

you should give a try with master version since the fix in #111 might have resolved your issue...

ryanwtyler commented 8 years ago

metanov's right. you can close this. thanks