GoogleWebComponents / firebase-element

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

_applySubPathChange fails when top level data is an array #118

Closed ryanwtyler closed 8 years ago

ryanwtyler commented 8 years ago

i have a custom element that i two-way bind with a firebase-collection element. My data looks like this initially:

meetData: [{name: "ryan tyler", lotId: 1}]

this updates my firebase data fine. i immediately add to this object which is the first item of an array.

with this line:

this.set('meetData.0.attempt1', {attemptNum:1, declared: 100, b_currentAttempt: false});

i get this error: firebase.js:129 Uncaught Error: Firebase.child failed: First argument was an invalid path: "undefined". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"

on line 337 of firebase-collection .html. the 336-338 are:

// 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;

and firebaseKey is 'undefined'. i think because the top level of the data is an array.