-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement useQuery Infinite Loading #819
Comments
Just wondering what's the reason for this not working the same as pagination? Can't we build this into |
@eliasjohansson Good question — if you want to explore how we could do this, that'd be awesome! |
@flybayer Sure, ill have a go at it after work today. |
Been playing with this for a while. First of all there seems to be a problem with the useInfiniteQuery types react-query#390. I had to have almost everything as My biggest issue right now is prisma together with infinte query. Prisma does not provide any "pagination metadata" when using Also baking this into the useQuery function would maybe make it more of a mess than needed, especially when it comes to types. |
Ok thanks for digging into this! Let's keep it separate. For |
Let me know if anyone wants to work on this but you need more information about how to build it! |
@eliasjohansson sorry for the delay here. I'm not quite following you on that 🤔
I just added to the first post the implementation for the blitz query that should work with my useInfiniteQuery example. |
@flybayer Hmm, I think I might have been trying to use react-query too much as is. Normally the getFetchMore parameter would be sent through to the query function, and then you use it there to fetch depending on it. So in ur example we would only use the getFetchMore to tell the useInfiniteQuery if there is more to fetch or not. Will try that instead. |
Blitz needs to export a
useInfiniteQuery
hook that's a thin wrapper on theuseInfiniteQuery
hook from react-query. This will be done very similar to how we are wrapping theuseQuery
hook.useInfiniteQuery
should be fully typedAnd here's the query to work with that:
Note: It's possible I've overlooked something critical in the above code, so is something doesn't seem right, it might not be right!
The text was updated successfully, but these errors were encountered: