How can i map/extend the results of a paginatedQuery?
I'm running a paginated query on a lookup table that returns objects with reference to the actual document. How can i do this? Below is the query i tried to use, but when calling
loadMore
i get this error:
Relevant part from the query:
I'm assuming the problem is that I'm returning a page of Doc<"feedItem">
instead of `Doc<"PersonalFeedItem">... What would be a better approach here?3 Replies
Bonus question: Any elegant idea for my handling of user being null? (
q.eq("userId", user?._id || ("" as Id<"users">)),
)
I'm doing this because everytime the query runs once with getCurrentUser() returning null, although I'm definitely logged in 😕. Looks somehow similar to the problem @Igor Kotua described in https://discord.com/channels/1019350475847499849/1209086079303426059...Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
You're mapping the results correctly. The InvalidCursor error happens if the query's index range changes between requests, so it's probably caused by the
user?.id || ""
which is causing the second page to be fetched with a different user id than the first page.
When you render this query, is it possible to put it within a <Authenticated>
component?Ah, makes perfectly sense. Thank you 🙂