[convex-helpers]: useQueryWithStatus error: "could not find Convex client"
Calling
useQueryWithStatus
from my frontend causes this error for some reason:
Could not find Convex client!
useQuery must be used in the React component tree under
ConvexProvider. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app
I tried defining useQueryWithStatus
in a few different locations in my convex folder, all with the same result. Updated to latest convex-helpers
version.
3 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!
In a monorepo setup, defining
useQueryWithStatus
locally in the frontend app instead of in our backend package seems to solve it for now - but shouldn't it be possible to define it in the backend package and share that one defiintion across apps? I can see that we've done that successfully in another monorepo projectuseQueries
has to be provided by the application that's using the hook, otherwise you end up referencing a separate react instance (hence the error). So those two lines of code you pasted need to be present in each frontend application that uses it.