pagination query 2 server requests on start
hello. please explain why paginated query is executing 2 times on first execution even it is exhausted?
it think the problem is with convex source code:
First execution: Gets the initial page of results
Second execution: Checks if there are more items after the current page
its doing second request even if first is already 'Exhausted'
5 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!
hmm could this be React Strict Mode?
hm it runs on the backend twice, could it be rerunning because that function accesses auth and the auth changes?
First execution: Gets the initial page of results Second execution: Checks if there are more items after the current pageAh so you think this might be broken in https://github.com/get-convex/convex-js/blob/main/src/react/use_paginated_query.ts ? Could be!
no i double checked everything
its usepaginationquery problem
and your proposed behavior would be for it not to do a second check if the first one is exhausted
sounds good, want to write the PR? 🙂
this isn't a priority right now since it's not broken (ie the data is correct), but sounds like fixing it is the right thing to do as long as it doesn't make the code much more complicated
thanks for letting us know, I've filed this internally. I'd like to fix this, it might be a while. If you've got a pointer on it or a suggested patch it could help it get fixed sooner.
ok will look into it. thanks