Jacob Kim
Jacob Kim3w ago

how do I do optimistic update with a paginated query?

let's say api.queries.foobar is a paginated query. how can I perform an optimistic mutation witt that query? Here is a sample code.
export function useMutation() {
const mutationFn = useConvexMutation(api.queries.foobar).withOptimisticUpdate((localStore, args) => {
const list = localStore.getQuery(api.queries.foobar, { paginationOpts: { numItems: 10 }})
// TODO
})
return useMutation({ mutationFn })
}
export function useMutation() {
const mutationFn = useConvexMutation(api.queries.foobar).withOptimisticUpdate((localStore, args) => {
const list = localStore.getQuery(api.queries.foobar, { paginationOpts: { numItems: 10 }})
// TODO
})
return useMutation({ mutationFn })
}
I am not sure how I can fill in the paginationOpts of the query.
2 Replies
Convex Bot
Convex Bot3w ago
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!
Jacob Kim
Jacob KimOP3w ago
ok it seems like this has already been discussed, but it is not resolved. https://discord.com/channels/1019350475847499849/1324674398258593833 Has there been any updates to this?

Did you find this page helpful?