Llabe
Llabe
CCConvex Community
Created by Llabe on 11/15/2024 in #support-community
Stable pagination
I am building an application and I need to add pagination to my tables but at the same time I don't want to have loading blinks when I apply filter. I followed this guide: "Help, my app is overreacting!". First when I added the stable it worked fine, but when I implemented the pagination it broke. I don't know what could be causing the problem. Has anyone have a similar problem?
3 replies
CCConvex Community
Created by Llabe on 10/14/2024 in #support-community
What is the best approach for handling members?
In my application ill have teams and each team will have multiple projects, chats, etc... ANd I want to handle members. For the teams I have a team table and a teamMembers table (where I track members and roles). What about the projects and chats inside the team (ill have public ones -> Everyone is member, and then private ones -> the admin assigns who is a member there), so I don't know if I should store this chat/project members as an array of ids inside the project/chat table or also have separate tables for this. Thanks for your time
6 replies
CCConvex Community
Created by Llabe on 10/14/2024 in #support-community
Schema with array of objects
Is it efficient to have an array of objects? Let's say that I have a task with the field sub tasks, and I want those to be objects with x,y,z fields and each task can handle multiple sub taks.
5 replies
CCConvex Community
Created by Llabe on 9/23/2024 in #support-community
What is the recommended approach to structure my app?
I am using Nextjs + Convex and I am wondering how is the best way to structure the app. When I am not using convex and I use a regular db I generally do this: -The front end layer (either client or server component) -Acitons (my server actions) -Data-access (Where I access the db) And I do this flow: The front if its a query call the data-access from the server (server component) And if it is a mutation/action that I need to perform, I usually use react tanstack query to perform those server actions. What is the recommended approach for convex? Thanks for your time
2 replies
CCConvex Community
Created by Llabe on 4/6/2024 in #support-community
Deploying Next 14 + Convex in Vercel
When I first try deploying my application, it throw an error because it was missing the CONVEX_DEPLOY_KEY. So I added it and reployed, but now it's saying: Detected a non-production build environment and "CONVEX_DEPLOY_KEY" for a production Convex deployment. If someone had this issue, I would love to hear how you fix it 😄
15 replies
CCConvex Community
Created by Llabe on 3/26/2024 in #support-community
Pagination + Optimistic updates
I have two questions, one exclusively related to pagination and another with combines pagination with optimistic updates. Basically I am building a chat in my applicatin so team members can talk to each other. 1) In the code below you can see my convex function to return members form a project which should go to the chat members list. But I have to populate the user data field so thats why I have the promise all, when I try to implement it with pagination using the documentation in the convex web I get an error as I can't iterate a PaginatedREsult (I belive its call like that), and if I access the data then the paginated query throws an error: export const getMembers = query({ args: { projectId: v.id('projects'), }, handler: async (ctx, args) => { const access = await accessToProject( ctx, args.projectId, 'juanillaberia2002@gmail.com' ); if (!access) return []; const projectMembers = await ctx.db .query('project_members') .withIndex('by_projectId', q => q.eq('projectId', args.projectId)) .collect(); // const projectMembers = await ctx.db // .query('project_members') // .withIndex('by_projectId', q => q.eq('projectId', args.projectId)) // .paginate(args.paginationOpts); return await Promise.all( projectMembers.map(async member => { const userData = await ctx.db.get(member.userId); return { ...userData, role: member.role, }; }) ); }, }); 2) And second, is it possible to implement optimistic updates and also paginate messages? I successfully implemented the optimistic updates, but I am not quite sure how to add the pagination (because of the question 1 and also if they go well together or their are meant to be separated features) as messages contain the userId who sent it and I need to query for the image and the name. Thank you so much for your time! 🙂
16 replies
CCConvex Community
Created by Llabe on 3/21/2024 in #support-community
Global state?
Hey everyone! I am building a team base application using Nextjs 14 and Convex. The main page of the team is a dashboard where you can access different features. Comming from React Client components and the context API, I would probably fetch the data from my database using something like tanstack react query and then access the data needed on each dashboard window (to avoid refetching data). I don't have that much experience with server components, and I was wondering if there is any way to replicate something similar to what I mention. Or if its okey to just have multiple convex queries around. Sorry if its a silly question 🙂 Have a good one!
3 replies
CCConvex Community
Created by Llabe on 3/18/2024 in #support-community
How to implement next-auth with convex?
Hi! I am building a next.js application. The basic idea is to create teams/projects to work together in X,Y,Z stuff. I am having some problems with authentication, I set up next-auth with some providers and the sessions work fine. But when it comes to Convex, I don't know how to protect data (only allow memebers of a team access the data of that team). And when an user authenticates if its new I would like to add it to the DB else just access that user data from the DB. Thanks for your time!
16 replies