vuefire: Passing a query to useCollection gives warning "could not get path of the data source"
Reproduction
coming soon
Steps to reproduce the bug
- Install
vuefire@3.1.0 - Run the following code
<script setup lang="ts">
const q = query(getCol('companies'), orderBy('createdAt', 'desc'))
const { data: companies, pending } = useCollection(q)
</script>
<template>
<p v-if="!pending && companies.length === 0">No companies yet</p>
<div v-for="company in companies" :key="company.id">{{ company.name }}</div>
</template>
- Observe that
pendingresolves early causing any templates that depend on it to flash momentarily before being replaced with data. - Observe that the data loads and is ordered correctly.
- Check the logs for
[VueFire SSR]: Could not get the path of the data source
Expected behavior
I would expect that passing a query to useCollection would behave the same as passing a raw collection.
- pending would resolve when fully complete to avoid flashing any template fragments that depend on it
- there would be no warning
- data would load correctly
Actual behavior
- pending resolves early, flashing “no companies yet” fragment before replacing with data
- throws a warning in the console
- data loads correctly from query, in correct order
Additional information
I set a breakpoint in the source. Here’s the result in Chrome Dev Tools with some of the local context showing.

About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 4
- Comments: 17 (8 by maintainers)
Demanding a maintainer fix something like this is not a good way to encourage them.
First, you should explain exactly why you need to get rid of the warning, because usually warnings don’t affect anything.
Second, you can already get rid of the warnings based on the links to documentation above. For example https://vuefire.vuejs.org/guide/ssr.html#Manual-SSR-keys explains that you can manually set an SSR key. This will make it go away
Finally, consider sponsoring Posva so that he can reach his sponsorship goal and work on his open source projects full time. https://github.com/sponsors/posva
Not yet 😄
https://github.com/vuejs/vuefire/blob/66f42ed62dffde01063c78ad48519157be66de57/src/ssr/plugin.ts#L42-L47
@posva I suppose it doesn’t matter that I’m not using SSR?
For queries, you need to pass an
ssrKeyto the options ofuseCollection(): https://vuefire.vuejs.org/guide/ssr.html#manual-ssr-keysI’m also not using SSR (ssr: false in Nuxt config) and get this SSR related warning. Ideally, if no SSR is being used, there wouldn’t be any warning related to it.
From what I can gather they plan to fix this by hiding the message for those not using SSR. The fix just hasn’t been released yet. Maybe creating a PR would be helpful for the repo owner.
Adding the
ssrKeyis a workaround until the fix is released.it must be a unique key across your application