Actually, this.$firebaseRefs is not populated to child components so I have to access it through vue-router on a computed property:
// Features.vue (child of App.vue)
computed: {
$firebaseRefs () {
return this.$router.app.$firebaseRefs;
}
}
and then my update() method throws an error:
Firebase.update failed: First argument contains an invalid key (.key) in path /.key. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"
update () {
this.$firebaseRefs.features.child(this.feature['.key']).update(this.feature);
}
I tried using this reference directly, but it says child is not a function
firebase: function () {
return {
features: db.ref('features')
};
}
this won't work: this.$router.app.features.child(feature['.key']).update(feature), child is not a function.
You're talking about many different things at the same time
$firebaseRefs are local to the component as you can use the same keys in different components.key is added to the data for convenience, you cannot include it in a Firebase update. so you can: const update = Object.assign({}, item)
delete item['.key']
child on a ref on Reference (https://firebase.google.com/docs/reference/js/firebase.database.Reference#child) and not on a Query (https://firebase.google.com/docs/reference/js/firebase.database.Query). If you have a query you can access the Reference with .refI'll add a note on the Readme, because right now it's missleading