CSFrequency / react-firebase-hooks

React Hooks for Firebase.
Apache License 2.0
3.55k stars 304 forks source link

useDocumentData returns undefined on first render until forced browser refresh returns data #305

Open Kylescottw opened 1 year ago

Kylescottw commented 1 year ago

Using latest next "next": "13.4.4", reference ticket: https://github.com/CSFrequency/react-firebase-hooks/issues/252

const queryRef = query(
    collection(db, "tournaments"),
    orderBy("date"),
    where("date", ">", timeStamp),
    limit(1)
  );

  const [tournaments, loadingTournaments, errorTournaments] = useCollectionOnce(
    queryRef,
    {
      snapshotListenOptions: { includeMetadataChanges: true },
    }
  );