Sorting Firebase Entries by Date Descending and Backnavigation

Hello,

i’ve got a List of entries from my firebase DB via an observable. Im sorting the result by a Date-Field called “referenzDatum”. The Ion-list looks like this, new to old.

  • 27.07.2017
  • 24.07.2017
  • 01.07.2017
  this.entriesRef$ = this.database.list('entry',
{
  query: {
    orderByChild: "referenzDatum"
  }}).map((array) => array.reverse()) as FirebaseListObservable<any[]>;;
 
  this.entriesRef$.subscribe();                 
  }

this works fine. On the Same Page i’ve got a FAB which navigates to another Page where i can add additional datasets. This also works fine: When the User presses the Save-FAB, the Data is stored in Firebase and the user is brought back to the List-Page. There i also can immedialelly see the new entry - but the sorting is broken:

  • 01.07.2017
  • 24.07.2017
  • 30.07.2017 <- the new entry
  • 27.07.2017

When i refresh the page, the items are sorted correctly again

The same thing happens when i remove an Item from the list via a button on the same page.

thank you