title: Angular firebase persistence fetch new data from firestore
body: <p>I created an angular 8 app with firestore using angularfirebase.<br>
  The app should work offline, this works fine by enabling persitence on firebase. (And create a serviceworker etc. for angular).<br>
  Now I fetch my data from firestore like this   </p>
  
  <pre><code>public async get(): Promise&lt;Customer[]&gt; {
    return await this.itemsCollection.valueChanges({ idField: 'id' }).pipe(take(1)).toPromise();
  }
  </code></pre>
  
  <p>I don't prefer the observables with async pipe approach because it makes everything too complex.</p>
  
  <p>The problem I have now, if I update some data in firestore itself or on another device, the local data doesn't update. After I refresh the page, it keeps fetching the old cached firestore data.
  I tried to fix this by clearing the persistence cache but I don't know where to put it in my code to make it work.</p>
  
  <pre><code>private db: AngularFirestore, // in constructor
  this.db.firestore.clearPersistence(); // somewhere after initializing firebase
  </code></pre>
  
  <p>I also think that it's not a good production ready solution.  </p>
  
  <p>How can I solve this problem?<br>
  Maybe I should go for observables after all and rewrite everything.</p>