Search code examples
javascriptfirebasepolymerfirebase-realtime-databasepolymerfire

Polymerfire query is not returning new data when path changed


Here is Youtube link for issue

I am trying to change path using firebase-query as following

<firebase-query
        id="query"
        log
        order-by-child="name"
        app-name="appname1"
        path="/posts/[[collectionPath]]"
        data="{{posts}}">
</firebase-query> 

following is my data structure

enter image description here

Polymer({

  is: 'my-view2',

  properties: {
      collectionPath: {
      type: String,
      value: "",
      notify: true
    }
  },
  updatePath:function (selectedTab) {
    this.set('collectionPath', selectedTab);        
  }
});

On tab click I am calling function updatePath() like updatePath('Android')

But query is not returning new data when path changed. It return me data when I reload the app. Please help


Solution

  • Finally i did it myself and i would like to share with you.

    Just set path to null i.e this.$.query.path = null; as following code

    updatePath:function (selectedTab) {
      this.$.query.path = null;
      this.set('collectionPath', selectedTab);        
    }