pagination and TanStack Start
In https://docs.convex.dev/client/react/tanstack-start
Using Convex React hooks Convex React hooks like usePaginatedQuery can be used alongside TanStack hooks. These hooks reference the same Convex Client so there's still just one set of consistent query results in your app when these are combined.Is the code below the correct use of the usePaginatedQuery hook with TanStack Start?
TanStack Start | Convex Developer Hub
TanStack Start is a new React web framework
38 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!
The goal is to have an infinite scroll page with the initial data is rendered by the server. The useSuspenseQuery resolves, but the usePaginatedQuery remains in a pending state. It looks like the query is never invoked when isolated after having a look at the server logs.
also TanStack Start is in Beta now 🎊
there's no supported way to use usePaginatedQuery with useSuspenseQuery yet
this looks like a good direction but there's work in the library to be done to do this
the thing is when I strip out the suspense and loader code, the usePaginatedQuery problem still persists.
I hope a straight
usePaginatedQuery()
works, are you saying that's not working too?correct.
Could you show that code?
so fontsPaginated is always undefined?
yes
ah
and the query is never invoked
i see no logs
from the console.log in the query def
oh try useConvexPaginatedQuery
just in case you're using usePaginatedQuery imported from react-query
or make sure that usePaginatedQuery is imported from "convex/react"
import { useConvexPaginatedQuery } from "@convex-dev/react-query";
import { usePaginatedQuery } from "convex/react";
yea neither work
and sounds like the function isn't running based on convex backend logs
could you check the websocket, see if there's a query with that name being requested?
do other normal Convex hooks work? like
useQuery
from "convex/react", or useConvexQuery
from "@convex-dev/react-query"?
data is undefined
from convex/react
same for useConvexQuery
it's expected these are undefined at first, but you're saying they stay undefined forever?
however this code works as expected
So is sounds like nothing works form the client at all
useSuspenseQuery runs on the server for SSR
(as well as on the client)
That might be the wrong websocket
nothing gets rendered
the websocket connection we're looking for hits an endpoint called /sync
maybe there is no websocket
If you put a console.log("hello") next to the COnvexProvider, does that run on the client?
do you have a <ConvexProvider> component somewhere?
Or if you put a console.log next to this useQuery, does that run on the lcient?
You say TanStack Start so I'd think everything would run on the client
i see console logs from vinxi and the client
Could you shre this? is there an example you based this on?
i used
npm create convex@latest -- -t tanstack-start
ill share the repo. just gotta create some seed dataonce I add the seed data I get something, with or without suspense
I think that's the only change i made, in app/routes/index.tsx
this is the websocket I mean
ive done no work on the frontend so im just gonna start fresh as a sanity check and if the problem persists ill share the repo
i am getting some client errors
client.tsx:10 Uncaught Error: Root element not found
at client.tsx:10:9
site.webmanifest:1 Manifest: Line: 1, column: 1, Syntax error.
so something aint right
Oh what versions o fthings are youusing
there are changes I need to make, in the beta Root doesn't exist anymore
here let me do that right now, that ight be the confusino
well what versions are you using though
those ^ mean it could be anything
here's I'll fix these
oh yea lol
ok sorry about that! I hadn't updated the template since the last change before the beta
either create a new project with that template, or make these changes: https://github.com/get-convex/templates/commit/9fda5289acce30de2499968946e6637dce73dde3
gotta update the quickstart too
thanks Tom! We're in business.