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

useFindMany() Reactive Query returns empty array on first render. #27

Open
joonshakya opened this issue Jun 19, 2024 · 2 comments
Open

Comments

@joonshakya
Copy link

joonshakya commented Jun 19, 2024

In useFindMany() reactive query, while it is fetching data from the database, it would be great to have a loading state. Like returning { data, isLoading } or just returning undefined when the data is being fetched.

In the current implementation, it returns an empty array which triggers "no data found" screen in my use case and I didn't find a way to distinguish if prisma is fetching the data or if the data is actually empty.

@sorenbs
Copy link
Member

sorenbs commented Jul 6, 2024

Thanks @joonshakya!

I like the idea of { data, isLoading }.

Do you think we should have this interface for all the query functions?

@ovidb
Copy link

ovidb commented Jul 7, 2024

It feels natural -- most data fetching libraries have this interface, but we might as well add error in the mix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants