Open
Description
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
pending
resolves 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.