polymerfire
polymerfire copied to clipboard
Firebase-query data not updating after using this.app.database().ref(myRef).push(myObject)
Description
I am wrapping firebase-query with a custom element called firebase-cart and using the app parameter to push values to database. I have an observer on the cart parameter which gets called correctly on init, but doesn't get called when item is pushed using the custom function. It is called using this.$.cart.pushToCart(item);
where cart is the id for an instance of firebase-cart. The complete element is in this codeshare.
Expected outcome
Firebase-query data property updating after calling push method.
Actual outcome
Data property does not update.
Live Demo
Not a live demo, but it's the relevant code. https://codeshare.io/5NoVo9
Browsers Affected
- [ x ] Chrome
I see a couple of things that you might want to look at:
"app" isn't a declared property.
You might try something like this
let query = Polymer.dom(this.root).querySelector("firebase-query"); // or use an id in your query element
query.ref.push(item)...
I declared app as so:
app: { type: Object, notify: true }
and used your alternative push method, which works as expected, but cart is still failing to update. Codeshare has been udpated with changes. As an aside, when I update a value from the console it correctly updates any data bindings that might exist, but still doesn't trigger the observers.
I have the same with <firebase-document>
.
I am pushing, no update for the "data" property. If I refresh, it gets update. If I delete something, it also works. But no realtime update after pushing (.saveValue
).