useQuery different return types
Hello, I'm fetching data with useQuery and for some reason it has two different return types. In one component it returns an object with the data, error, etc properties while in the other it only returns the data.
returns entry type | null | undefined
returns an object with data about the query as well
6 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Preferably it would always return the object including information on the query status.
For example with entry, I want to display an error if there was a problem fetching the data. Though if there just isn't an entry yet I know to create one.
Hey @entropy can you share the queries?
Sure
anime_entries.authSingleById
lists.authAll
You might be using two different
useQuery
functions, it's a common name for a function. There's useQuery
that TanStack Query AKA React Query exports, and there's one that Convex exports. And more in other libraries!Ahh that was it. One was imported from convex/react and the other from convex-helpers/react.
Thanks for the help!