Skip to content

Passing a query to useCollection gives warning "could not get path of the data source" #1315

Open
@Soviut

Description

@Soviut

Reproduction

coming soon

Steps to reproduce the bug

  1. Install vuefire@3.1.0
  2. 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>
  1. Observe that pending resolves early causing any templates that depend on it to flash momentarily before being replaced with data.
  2. Observe that the data loads and is ordered correctly.
  3. 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.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions