Llabe
Llabe
CCConvex Community
Created by Llabe on 10/14/2024 in #support-community
What is the best approach for handling members?
I have used but never for a "Big project", I have been using NoSQL for my last projects.
6 replies
CCConvex Community
Created by Llabe on 10/14/2024 in #support-community
What is the best approach for handling members?
Thanks @ballingt !
6 replies
CCConvex Community
Created by Llabe on 10/14/2024 in #support-community
Schema with array of objects
Ohh I like that approach. Ill give it a try. Thanks!
5 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
Okey, i'll try again then
15 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
I could try with netlify instead, to see if it works there
15 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
"convex": "^1.10.0",
15 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
I beive the last one, but let me check
15 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
I am doing the deployment in vercel importing everything from my github
15 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
I was thinking the same. The optimistic, I may be able to implemented in the front end.
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
@Michal Srb In your opinion, if I can only choose one of the convex feature, should it be the pagination or the optimistic updates?
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
Okey perfect, no worries. I'll try to make it work. Thanks!
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
Sorry for all the messages. Basiccaly I am able to paginate when I click the btn I get more messages all good, but the optimistic is taking the 'regular time', I am probably doing something wrong
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
//This is where I send the messages const ChatInput = ({ projectId, userEmail, }: { projectId: Id<'projects'>; userEmail: string; }) => { //Message value const [message, setMessage] = useState(''); const sendMessage = useMutation( api.messages.sendMessage ).withOptimisticUpdate((localStore, mutationArg) => { optimisticallyUpdateValueInPaginatedQuery( localStore, api.messages.getMessages, { projectId }, crrVal => { const crrUser = localStore.getQuery(api.users.getUserByEmail, { email: userEmail, }); const newMessage = { _id: crypto.randomUUID() as Id<'messages'>, _creationTime: Date.now(), projectId, data: mutationArg.data, sendBy: crrUser, }; return { ...crrVal, newMessage, }; } ); }); const handleSendMessage = async ( projectId: Id<'projects'>, newMessageText: string ) => { await sendMessage({ projectId: projectId, data: newMessageText }); }; return ( ... ); }; export default ChatInput;
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
//This is the conversation page: const Conversation = ({ projectId }: { projectId: Id<'projects'> }) => { const { results, loadMore, status } = usePaginatedQuery( api.messages.getMessages, { projectId }, { initialNumItems: 1, } ); if (status === 'LoadingFirstPage') return ( <ul className='flex flex-col flex-1 gap-6 w-full'> <MessageLoader /> <MessageLoader /> <MessageLoader /> <MessageLoader /> <MessageLoader /> </ul> ); console.log(results); return ( <ul className='flex-1 w-full overflow-y-auto'> <button onClick={() => loadMore(1)}>MORE</button> {results.length > 0 ? ( results .sort((a, b) => a._creationTime - b._creationTime) .map(msg => ( <Message messageData={msg} senderData={msg.sendBy} isFirstInGroup={true} /> )) ) : ( <p className='flex justify-center items-center h-full text-sm text-center text-text-2'> No messages yet </p> )} </ul> ); }; export default Conversation;
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
I was able to implement the pagination. But the optimistic updates in combination with the pagination is not working for me. Its now throwing any error but the mmessages are not being added with the optimistic. My implementation: //get messages function export const getMessages = query({ args: { projectId: v.id('projects'), paginationOpts: paginationOptsValidator, }, handler: async (ctx, args) => { const messages = await ctx.db .query('messages') .withIndex('by_projectId_time', q => q.eq('projectId', args.projectId)) .order('desc') .paginate(args.paginationOpts); return { ...messages, page: await Promise.all( messages.page.map(async msg => { const userData = await ctx.db.get(msg.sendBy); return { ...msg, sendBy: { ...userData, }, }; }) ), }; }, });
16 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
Thanks you @lee and @Michal Srb . I'll try to implement it now
16 replies
CCConvex Community
Created by Llabe on 3/21/2024 in #support-community
Global state?
Perfect, thanks!
3 replies
CCConvex Community
Created by Llabe on 3/18/2024 in #support-community
How to implement next-auth with convex?
Amazing! Thank you very much. I'll try to implement it
16 replies