You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug occurs in the Firebase library starting with version 8.0.*.
I have a Firestore listener listening to a list of 50 documents ordered by creation date descending. The creation date is a number field on the Firestore document (the value is the milliseconds returned from Date.now()), not the internal Firestore document timestamp.
Previously, before version 8.0.*, when I add a new document with the latest timestamp (ms), the document would appear at the top of the list because it was the newest document. This is expected. It definitely behaves this way with version 7.* because I had to revert back to that version.
With version 8.0.*, the newly created document appears at the bottom of the list of 50. This is the bug. When refreshing the page, the item appears first, as expected. So the problem is with the listener, not the data.
Relevant Code:
// listen to the docs ordered by createdAt descfirestore.collection('items').orderBy('createdAt','desc').limit(50).onSnapshot(querySnap=>{// display docs in browser});// add a new docconstnewItem={text: "yo, I'm new",createdAt: Date.now()}firestore.collection('items').add(newItem)// the new item appears in the list, // In firebase 7.* the new item appears first, as expected// In firebase 8.*, the new item appears at the end instead of first. When refreshing, the new item appears first, as expected.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
This bug occurs in the Firebase library starting with version 8.0.*.
I have a Firestore listener listening to a list of 50 documents ordered by creation date descending. The creation date is a number field on the Firestore document (the value is the milliseconds returned from
Date.now()
), not the internal Firestore document timestamp.Previously, before
version 8.0.*
, when I add a new document with the latest timestamp (ms), the document would appear at the top of the list because it was the newest document. This is expected. It definitely behaves this way withversion 7.*
because I had to revert back to that version.With version 8.0.*, the newly created document appears at the bottom of the list of 50. This is the bug. When refreshing the page, the item appears first, as expected. So the problem is with the listener, not the data.
Relevant Code:
The text was updated successfully, but these errors were encountered: