polymerfire icon indicating copy to clipboard operation
polymerfire copied to clipboard

Firebase-query data not updating after using this.app.database().ref(myRef).push(myObject)

Open kr05 opened this issue 7 years ago • 3 comments

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

kr05 avatar Jun 07 '17 08:06 kr05

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)...

phidias51 avatar Jun 12 '17 17:06 phidias51

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.

kr05 avatar Jun 20 '17 02:06 kr05

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).

derhuebiii avatar Jan 09 '18 17:01 derhuebiii