#useQuery giving undefined while useSuspenseQuery gives results

1 messages · Page 1 of 1 (latest)

radiant patrol
#

Using TanStack Start. Here is the query.

export const getDeviceTypes = query({ args: {}, handler: async (ctx) => { return await ctx.db .query("device_types") .withIndex("by_categoryId", (q) => q.eq( "categoryId", "kn7bypng5v3mbmn4fnvrfd34r57azdcw" as Id<"deviceCategories">, ), ) .collect(); }, });

When I call it from my tsx page, if I use const { data } = useQuery(convexQuery(api.network.getDeviceTypes, {})); then I get undefined via a console.log. If I use useSuspenseQuery I get the array I expect.

I've also tried const data = useQuery(api.network.getDeviceTypes, {}); which also returns undefined.

long fjordBOT
#

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](https://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!
remote dagger
#

This is how TanStack Query works, data may initially be loading.

radiant patrol