Skip to content

When using a query in useCollection, pending is always false #1317

Description

@kduvignau

Reproduction

https://stackblitz.com/edit/vitejs-vite-iapj2w?file=src/App.vue

Steps to reproduce the bug

Install vuefire@3.1.0
Run the following code

<script setup lang="ts">
import { collection, orderBy, query } from "firebase/firestore";
import { useCollection, useFirestore } from "vuefire";

const db = useFirestore();

const { data, pending } = useCollection(query(collection(db, "users"), orderBy("createdAt", "desc")), { ssrKey: "users" });
</script>

<template>
  <div>
    {{ data.length }} - {{ pending }}
  </div>
</template>

Expected behavior

  • On first render, data.length should be 0 and pending should be true.
  • Once the query is completed, pending should be false

Actual behavior

  • data.length is 0 as expected but pending is false

Additional information

It works as expected when using useCollection without a query

const { data, pending } = useCollection(collection(db, "users"));

Note : my app is a SPA (I don't use Nuxt)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions