Firestore serverTimestamp() is null in the first snapshot after a write
@devsingh05▲ 10 net votes
With a local write, onSnapshot fires immediately with the pending value, and serverTimestamp fields are null until the server confirms. Read with doc.data({ serverTimestamps: 'estimate' }) to get a local estimate, or skip snapshots where snapshot.metadata.hasPendingWrites is true. Sorting by a null timestamp also briefly puts new items in the wrong place.