-
-
Notifications
You must be signed in to change notification settings - Fork 342
Closed
Description
Reproduction
Logging the reference and then logging the reference's value shows the issue.
Steps to reproduce the bug
- Using Firestore, create a collection called
rooms. - Create a
roomdocument inside theroomscollection with any kind of data, don't leave theroomdocument empty. - Pass the room's ID to the following function :
export const getRoomDocRef = (roomId: Room["id"]) => {
const db = useFirestore();
const roomDoc = computed(() => doc(db, "rooms", roomId));
const roomDocRef = useDocument<Room>(roomDoc);
console.log("Room", roomDocRef);
console.log("Room value", roomDocRef.value);
return roomDocRef;
};
Expected behavior
roomDocRef.value shouldn't be undefined.
Actual behavior
Here's the result in my browser's console :

I don't understand how _value (seen in the first log) can hold the correct values, while the second log (roomDocRef.value) returns undefined.
Additional information
I'm new to Vue, so I might be missing something there...
Metadata
Metadata
Assignees
Labels
No labels