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
Remove NO_ID_FIELD key from useFirestoreDocData,useFirestoreCollectionData, useDatabaseListData, useDatabaseObjectData.
This key is inserted when no idField option is passed to these functions. However, it ends up being pretty confusing. Instead, if idField is not provided, we can just omit the document id.
Reacted by Anton Vynogradenko, Mahesh Warrier, Fabio Milheiro, Carlos Florêncio, Neil West and Masato Hirokami
Hello, I think my issue may be slightly unrealtated; however, when following the example in the quickstart, instead of getting a boolean value I get "{NO_ID_FIELD: undefined}".
importReactfrom"react";import{useFirestoreDocData,useFirestore,SuspenseWithPerf}from"reactfire";constProducts=()=>{constburritoRef=useFirestore().collection("tryreactfire").doc("burrito");// subscribe to a document for realtime updates. just one line!constburrito=useFirestoreDocData(burritoRef);if(burrito.status==="loading"){return<p>Fetching burrito flavor...</p>;}return(<SuspenseWithPerffallback={<p>"Loading store stuff..."</p>}traceId={"Loading Store"}><div>
Products
<p>
The burrito is
{burrito.yummy ? "good" : "bad"}!
</p></div></SuspenseWithPerf>);};exportdefaultProducts;
@jhuleatt Jeff, in that case, how do we get the id of a created document, when it's generated by Firebase?
I believe it makes sense to still have something like _uid attached to docs.
Agree, why not default it to _id or something? Alternatively, let users set a global default so we don't have to keep passing { idField: "id" } on all useFirestoreCollectionData calls.
Reacted by Mahesh Warrier, Ian G, Míla Kuchta and Anthony Boyd
I agree with this. I'm even fine with keeping the current behaviour, as long as we have a way of omitting the id field completely.
We don't always need it. If I target a specific document only, I already know the Id, otherwise I can't target it. So having that field in there makes me have to filter it out every time i want to use the data.
Activity
SabrinaDanielle commentedon Dec 13, 2020
Hello, I think my issue may be slightly unrealtated; however, when following the example in the quickstart, instead of getting a boolean value I get "{NO_ID_FIELD: undefined}".
SabrinaDanielle commentedon Dec 13, 2020
maxprilutskiy commentedon Dec 30, 2020
@jhuleatt Jeff, in that case, how do we get the id of a created document, when it's generated by Firebase?
I believe it makes sense to still have something like
_uidattached to docs.jhuleatt commentedon Jan 6, 2021
@SabrinaDanielle it looks like the quickstart code is outdated, apologies for that. I filed #321 to fix the quickstart.
devth commentedon Mar 8, 2021
Agree, why not default it to
_idor something? Alternatively, let users set a global default so we don't have to keep passing{ idField: "id" }on alluseFirestoreCollectionDatacalls.cd-a commentedon Mar 21, 2021
I agree with this. I'm even fine with keeping the current behaviour, as long as we have a way of omitting the id field completely.
We don't always need it. If I target a specific document only, I already know the Id, otherwise I can't target it. So having that field in there makes me have to filter it out every time i want to use the data.