useDocument with Route Params empty path error #1416
-
|
I'm trying to replicate this example with Vue3, Firestore and Vite. I want to use params as part of the path for a document; however the const route = useRoute()
// since route is reactive, `contactSource` will be reactive too
const contactSource = computed(() =>
doc(collection(db, 'contacts'), route.params.id)
)
// contact will always be in sync with the data source
const contact = useDocument(contactSource)vuefire/docs/guide/realtime-data.md Line 69 in 6ec8a6c this is my actual code My routes are working and I can access their values both in the template and in the setup script Thanks!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The error means that |
Beta Was this translation helpful? Give feedback.
The error means that
route.params.roomis empty at some point. You can verify it within your computed andreturn nullif it's empty, VueFire will still work withnullas thecharacterSource