How do you handle pagination with Wasp's useQuery?
I'd like to paginate my query but not sure on syntax or if it is supported. I see there's an old issue from 2021 here https://github.com/wasp-lang/wasp/issues/264 curious if others have found a way around it
version: 0.14.0
GitHub
Add support for pagination in Wasp · Issue #264 · wasp-lang/wasp
Pagination is so often needed that we should add some support for it in Wasp. One way might be to add support on react-query level, similar like BlitzJS does. Another option might be to add support...
2 Replies
Hi @wardbox. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the provided knowledge sources do not contain specific information on how to handle pagination with Wasp's
useQuery
hook. However, the useQuery
hook does accept a queryFnArgs
parameter, which is the arguments object (payload) you wish to pass into the Query. This could potentially be used for pagination parameters, but the exact implementation would depend on your specific use case and how your backend handles pagination.
For more detailed information on the useQuery
hook, you can refer to the Wasp documentation (https://wasp-lang.dev/docs/data-model/operations/queries#the-usequery-hook-1).
As for the GitHub issue you mentioned, it's not included in the provided knowledge sources, so I can't provide specific information on it. I recommend checking the latest comments on that issue or reaching out to the Wasp community for more up-to-date information.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @wardbox, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I just remembered opensaas has an implementation of it https://github.com/wasp-lang/open-saas/blob/1c666d889aa906c3af9281ba0886ead9c3e4df47/template/app/src/user/operations.ts#L60
gonna try to hack that to my needs
GitHub
open-saas/template/app/src/user/operations.ts at 1c666d889aa906c3af...
A free, open-source SaaS app starter for React & Node.js with superpowers. Production-ready. Community-driven. - wasp-lang/open-saas