-
-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First SSR call to useDocument fails but refresh and second call works #1509
Comments
Your |
I've amended the repro, and I still get the behavior:
|
I don't know what you are trying to achieve but I tested locally after updating packages and it works. You don't need to await the promise either, consume the product directly in the template. VueFire uses Cheers. |
Thanks @posva for making an attempt at reproduction. I've amended the repro as you suggested (and tried with just the emulators), but the behavior is still happening. The first time I fetch a specific document id using As you pointed out in previous iterations, my usage may be at fault here. I've tried to simplify things as much as possible to make it easy to reproduce, so it confounds me that you can't. Here's what I'm doing:
|
Hi @posva, can you take another look? I've added some more context. |
I was having a similar issue with In the end I just ended up using the built in const currentUser = await getCurrentUser();
const userDoc = useUserDoc();
onMounted(() => {
// Hydrate user state
if (currentUser) {
const userDocRef = doc(db, "users", currentUser.uid);
onSnapshot(userDocRef, (doc) => {
userDoc.value = {
id: doc.id,
...doc.data(),
} as UserDoc;
});
}
}); Works like a charm. |
Reproduction
https://github.com/harrycheung/nuxt--vuefire-repro-template
Steps to reproduce the bug
Open the root page (app.vue)
Expected behavior
I expect output to look like:
Actual behavior
However, actual output looks like:
Additional information
My database has multiple 'products', and if I change the id, hot-reload, and refresh, the first
useDocument
call to fetch it fails. For example:The text was updated successfully, but these errors were encountered: