Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kduvignau opened this issue Mar 8, 2023 · 2 comments
Closed

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

kduvignau opened this issue Mar 8, 2023 · 2 comments
Assignees
Labels
bug firestore new Cloud Store

Comments

@kduvignau
Copy link

kduvignau commented Mar 8, 2023

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)

@posva posva added the need repro label Mar 8, 2023 — with Volta.net
@kduvignau
Copy link
Author

Hello @posva 👋

I just added a repro link, let me know if you need more information!

Thanks!

@posva posva added bug firestore new Cloud Store and removed need repro labels Mar 9, 2023 — with Volta.net
@BenJackGill
Copy link

Can confirm this. I am having the same problem.

@posva posva self-assigned this Jul 27, 2023
@posva posva closed this as completed in 61513f6 Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug firestore new Cloud Store
Projects
None yet
Development

No branches or pull requests

3 participants