Disabling query with TanStack Query
I am fetching data using convex query with TanStack query in my React project.
I want to disable running query by condition.
Here is the code.
So I want to run query only when select file. But it throws an error to convex log when the page is refreshed because the fileId is not immediately available: ArgumentValidationError: Value does not match validator. Path: .fileId Value: null Validator: v.id("files")
How can I solve it?
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!
Today you can use "skip" instead of enabled, see https://github.com/get-convex/convex-react-query/issues/5
but we should implement enabled, I left that issue open to remind us
here's an example https://github.com/get-convex/convex-react-query/blob/9362c619f2fb37d1a825dd5e513536bd4d6130fc/src/example.tsx#L72-L75
GitHub
convex-react-query/src/example.tsx at 9362c619f2fb37d1a825dd5e51353...
Contribute to get-convex/convex-react-query development by creating an account on GitHub.