title: posts do not load after addind onAuthStateChanged
body: <p>I recently added the onAuthStateChanged function  in constructor, and if the user is not null then i call a function to get the posts (events). But the data of the function does not load until i click somewhere in the page and then the data shows. There are no errors shown.</p>
  
  <p>I tried clearing the onAuthStateChanged and the data loads OK, but i need to add the security of firebase in this page.</p>
  
  <p>Here is my feed.ts , and the function getEvents()</p>
  
  <pre><code>public async getEvents() {
      this.events = [];
      const loading = await this.loadingCtrl.create({
        message: 'Loading events...'
      });
  
      loading.present();
      const query = firebase.firestore().collection('events').orderBy('created', 'desc').limit(this.pageSize);
  
      query.onSnapshot((snapshot) =&gt; {
        const changedDocs = snapshot.docChanges();
  
        changedDocs.forEach((change) =&gt; {
          if (change.type == 'modified') {
            for (let i = 0; i &lt; this.events.length; i++) {
              if (this.events[i].id === change.doc.id) {
                this.events[i] = change.doc;
              }
            }
          }
        })
      })
  
      query.get().then((events) =&gt; {
        events.forEach((event) =&gt; {
          this.events.push(event);
        });
  
        loading.dismiss();
        if (events.size == 0) {
          this.cursor = 0;
        } else {
          this.cursor = this.events[this.events.length - 1]; // the last index of the collection
        }
        console.log(this.events);
      }).catch((err) =&gt; {
        console.log(err);
      });
    }
  </code></pre>
  
  <p>Here is the constructon where i call the function getEvents(). The loading message shows when i open the app, but the data are not shown unless i click anywhere on the app. </p>
  
  <pre><code>constructor(public navCtrl: NavController, private loadingCtrl: LoadingController, private toastCtrl: ToastController, private http: HttpClient, public actionSheetCtrl: ActionSheetController, public alertCtrl: AlertController, public modalCtrl: ModalController, public popoverCtrl: PopoverController, private location: Location, ) {
  
      firebase.auth().onAuthStateChanged((user) =&gt; {
        if (user) {
          this.getEvents();
        } else {
          this.location.replaceState('/');
          this.navCtrl.navigateForward('login');
        }
      });
      // this.getEvents();
    }
  </code></pre>
  
  <p>The function works fine if i call it outside the condition if(user) { ...</p>