jamalsoueidanJ
Convex Community17mo ago
2 replies
jamalsoueidan

OptimisticUpdate

I'm using action to first send a post to third party service and then inserting into DB, the question is how to use the optimistic on the frontend, to insert into the localstorage?

//getData
const { results, status, loadMore } = usePaginatedQuery(
    api.message.paginate,
    { conversation: conversationId as Id<"conversation"> },
    { initialNumItems: 25 }
  );


//sendData (here how do i insert into the local storage for api.message.paginate)
const convex = useConvex();
convex.action(api.message.send, {
  conversation: conversationId,
  type: "text",
  text: {
    body: "hej med dig",
  },
  timestamp: 1,
});


Many thanks
Was this page helpful?