Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when binding data to an empty object #102

Open
mm-gmbd opened this issue Jan 27, 2016 · 0 comments
Open

Error when binding data to an empty object #102

mm-gmbd opened this issue Jan 27, 2016 · 0 comments

Comments

@mm-gmbd
Copy link

mm-gmbd commented Jan 27, 2016

I stumbled across this in an application I'm working on. In my application, I have an array that looks like the following (let's call it data):

properties: {
  data: {
    type: Array,
    value: function() {
      return [
        {
          location: "https://a-firebase.firebaseio.com/path/to/A",
          values: {}
        },
        {
          location: "https://a-firebase.firebaseio.com/path/to/B",
          values: {}
        }
      ]
    }
  }
}

I'm using this data structure to store data from multiple queries in a single object, in this case, data. I accomplish this by the following:

<template is="dom-bind" items="{{data}}" as="d">
  <firebase-document
    location="[[d.location]]"
    data="{{d.values}}"
</template>

However, the way this is laid out currently produces the following error:

Uncaught TypeError: Cannot read property 'update' of undefined

This has something to do with the fact that the values property for both elements in data is already defined.

If I remove values:

properties: {
  data: {
    type: Array,
    value: function() {
      return [
        {
          location: "https://a-firebase.firebaseio.com/path/to/A",
        },
        {
          location: "https://a-firebase.firebaseio.com/path/to/B",
        }
      ]
    }
  }
}

then I receive no error and the data from each query ends up happily at data[index].values for each element in the array.

I haven't seen this documented anywhere, so I tend to think this is a bug.

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

No branches or pull requests

1 participant