firebase-realtime-databasefirebase-polymerpolymerfire

firebase-query data observer not firing


I'm trying to handle a callback for firebase-query so that I can do some local filtering. I'm using polymerfire, specifically firebase-query web component to get all records in a particular path. Below is the usage

 <firebase-query  
        id="query"
        path="/Reports"
        data="{{allReportsData}}">
 </firebase-query>

Inside script tag

Polymer({

        is: 'pencco-app',

        properties: {
            allReportsData: {
                type: Object,
                notify: true,
                observer: 'dataChanged'
            }
        }
....

Problem is that the observer is not getting called.


Solution

  • Try changing your observer like this

    Polymer({
    
        is: 'pencco-app',
    
        properties: {
            allReportsData: {
                type: Object,
                notify: true
            }
        },
        observers: [
            'dataChanged(allReportsData.*)'
        ]
    ....
    

    The following link explains the deep linking required to observer changes to object properties: https://www.polymer-project.org/1.0/docs/devguide/observers#deep-observation